-
Notifications
You must be signed in to change notification settings - Fork 190
Add REST API for connection sharing management #1112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BimsaraBodaragama
wants to merge
1
commit into
wso2:master
Choose a base branch
from
BimsaraBodaragama:feature/idp-sharing-api-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
...wso2.carbon.identity.api.server.organization.connection.sharing.management.common/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| ~ Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com). | ||
| ~ | ||
| ~ WSO2 LLC. licenses this file to you under the Apache License, | ||
| ~ Version 2.0 (the "License"); you may not use this file except | ||
| ~ in compliance with the License. | ||
| ~ You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, | ||
| ~ software distributed under the License is distributed on an | ||
| ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| ~ KIND, either express or implied. See the License for the | ||
| ~ specific language governing permissions and limitations | ||
| ~ under the License. | ||
| --> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>org.wso2.carbon.identity.server.api</groupId> | ||
| <artifactId>org.wso2.carbon.identity.api.server.organization.connection.sharing.management</artifactId> | ||
| <version>1.6.8-SNAPSHOT</version> | ||
| <relativePath>../pom.xml</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common</artifactId> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.wso2.carbon.identity.organization.management</groupId> | ||
| <artifactId>org.wso2.carbon.identity.organization.management.organization.connection.sharing</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.wso2.carbon</groupId> | ||
| <artifactId>org.wso2.carbon.utils</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.cxf</groupId> | ||
| <artifactId>cxf-rt-frontend-jaxrs</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.cxf</groupId> | ||
| <artifactId>cxf-rt-rs-service-description</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>javax.ws.rs</groupId> | ||
| <artifactId>javax.ws.rs-api</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.jaxrs</groupId> | ||
| <artifactId>jackson-jaxrs-json-provider</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.swagger</groupId> | ||
| <artifactId>swagger-jaxrs</artifactId> | ||
| <scope>provided</scope> | ||
| <exclusions> | ||
| <exclusion> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-databind</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-annotations</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-core</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <groupId>com.fasterxml.jackson.dataformat</groupId> | ||
| <artifactId>jackson-dataformat-yaml</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <groupId>javax.ws.rs</groupId> | ||
| <artifactId>jsr311-api</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <groupId>com.google.guava</groupId> | ||
| <artifactId>guava</artifactId> | ||
| </exclusion> | ||
| </exclusions> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <properties> | ||
| <maven.compiler.source>8</maven.compiler.source> | ||
| <maven.compiler.target>8</maven.compiler.target> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
| </project> | ||
50 changes: 50 additions & 0 deletions
50
.../organization/connection/sharing/management/common/ConnectionSharingMgtServiceHolder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common; | ||
|
|
||
| import org.wso2.carbon.context.PrivilegedCarbonContext; | ||
| import org.wso2.carbon.identity.organization.management.organization.connection.sharing.ConnectionSharingPolicyHandlerService; | ||
|
|
||
| /** | ||
| * Holds the services which the connection sharing management API component is using. | ||
| */ | ||
| public class ConnectionSharingMgtServiceHolder { | ||
|
|
||
| private ConnectionSharingMgtServiceHolder() { | ||
|
|
||
| } | ||
|
|
||
| private static class ConnectionSharingPolicyHandlerServiceHolder { | ||
|
|
||
| private static final ConnectionSharingPolicyHandlerService SERVICE = | ||
| (ConnectionSharingPolicyHandlerService) PrivilegedCarbonContext | ||
| .getThreadLocalCarbonContext() | ||
| .getOSGiService(ConnectionSharingPolicyHandlerService.class, null); | ||
| } | ||
|
|
||
| /** | ||
| * Get ConnectionSharingPolicyHandlerService. | ||
| * | ||
| * @return ConnectionSharingPolicyHandlerService. | ||
| */ | ||
| public static ConnectionSharingPolicyHandlerService getConnectionSharingPolicyHandlerService() { | ||
|
|
||
| return ConnectionSharingMgtServiceHolder.ConnectionSharingPolicyHandlerServiceHolder.SERVICE; | ||
|
BimsaraBodaragama marked this conversation as resolved.
|
||
| } | ||
| } | ||
119 changes: 119 additions & 0 deletions
119
...ization/connection/sharing/management/common/constants/ConnectionSharingMgtConstants.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| /* | ||
| * Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common.constants; | ||
|
|
||
| /** | ||
| * Holds the constants which the connection sharing management API component is using. | ||
| */ | ||
| public class ConnectionSharingMgtConstants { | ||
|
|
||
| public static final String ERROR_PREFIX = "CSM-"; | ||
|
|
||
| public static final String CONNECTION_IDS = "CONNECTION_IDS"; | ||
| public static final String CONNECTION_NAMES = "CONNECTION_NAMES"; | ||
|
|
||
| public static final String RESPONSE_STATUS_PROCESSING = "Processing"; | ||
| public static final String RESPONSE_DETAIL_CONNECTION_SHARE = "Connection sharing process triggered successfully."; | ||
| public static final String RESPONSE_DETAIL_CONNECTION_UNSHARE = | ||
| "Connection unsharing process triggered successfully."; | ||
|
|
||
| /** | ||
| * Enum for connection sharing management related errors. | ||
| * Error Code - code to identify the error. | ||
| * Error Message - What went wrong. | ||
| * Error Description - Why it went wrong. | ||
| */ | ||
| public enum ErrorMessage { | ||
|
|
||
| // Client errors. | ||
| INVALID_SELECTIVE_CONNECTION_SHARE_REQUEST_BODY("60000", | ||
| "Invalid selective connection share request body.", | ||
| "The connection criteria provided for selective sharing is either null or empty. " + | ||
| "Please provide valid selective connection sharing criteria."), | ||
| INVALID_GENERAL_CONNECTION_SHARE_REQUEST_BODY("60001", | ||
| "Invalid general connection share request body.", | ||
| "The connection criteria provided for general sharing is either null or empty. " + | ||
| "Please provide valid general connection sharing criteria."), | ||
| INVALID_SELECTIVE_CONNECTION_UNSHARE_REQUEST_BODY("60002", | ||
| "Invalid selective connection unshare request body.", | ||
| "The connection criteria provided for selective unsharing is either null or empty. " + | ||
| "Please provide valid selective connection unsharing criteria."), | ||
| INVALID_GENERAL_CONNECTION_UNSHARE_REQUEST_BODY("60003", | ||
| "Invalid general connection unshare request body.", | ||
| "The connection criteria provided for general unsharing is either null or empty. " + | ||
| "Please provide valid general connection unsharing criteria."), | ||
| ERROR_MISSING_CONNECTION_CRITERIA("60004", | ||
| "Missing connection criteria in the request body.", | ||
| "The connection criteria is missing in the request body. " + | ||
| "Please provide the connection criteria to proceed."), | ||
| ERROR_UNSUPPORTED_CONNECTION_SHARE_POLICY("60005", | ||
| "Unsupported connection share policy.", | ||
| "The provided connection share policy is not supported. " + | ||
| "Please provide a valid connection share policy."), | ||
| INVALID_UUID_FORMAT("60006", | ||
| "Invalid UUID format.", | ||
| "The UUID provided in the request is not in a valid format. " + | ||
| "Please provide a valid UUID."), | ||
| ERROR_INVALID_LIMIT("60007", | ||
| "Invalid limit value.", | ||
| "The limit value provided in the request is invalid. " + | ||
| "Please provide a valid limit value."), | ||
| ERROR_INVALID_CURSOR("60008", | ||
| "Invalid cursor value.", | ||
| "The cursor value provided in the request is invalid. " + | ||
| "Please provide a valid cursor value."), | ||
|
|
||
| // Server errors. | ||
| ERROR_INITIATING_CONNECTIONS_API_SERVICE("65001", | ||
| "Error initiating ConnectionsApiService.", | ||
| "Error occurred while initiating ConnectionsApiService."); | ||
|
|
||
| private final String code; | ||
| private final String message; | ||
| private final String description; | ||
|
|
||
| ErrorMessage(String code, String message, String description) { | ||
|
|
||
| this.code = code; | ||
| this.message = message; | ||
| this.description = description; | ||
| } | ||
|
|
||
| public String getCode() { | ||
|
|
||
| return ERROR_PREFIX + code; | ||
| } | ||
|
|
||
| public String getMessage() { | ||
|
|
||
| return message; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
|
|
||
| return description; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
|
|
||
| return code + " | " + message; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.