diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/pom.xml
index 3caca39bac..0a9afd3f4b 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/pom.xml
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/pom.xml
@@ -44,5 +44,9 @@
org.wso2.carbon.identity.organization.management
org.wso2.carbon.identity.organization.management.application
+
+ org.wso2.carbon.identity.organization.management
+ org.wso2.carbon.identity.organization.discovery.service
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/management/common/OrganizationManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/management/common/OrganizationManagementServiceHolder.java
index d33796fa9c..8f2fcb35ca 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/management/common/OrganizationManagementServiceHolder.java
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/management/common/OrganizationManagementServiceHolder.java
@@ -18,6 +18,7 @@
package org.wso2.carbon.identity.api.server.organization.management.common;
+import org.wso2.carbon.identity.organization.discovery.service.OrganizationDiscoveryManager;
import org.wso2.carbon.identity.organization.management.application.OrgApplicationManager;
import org.wso2.carbon.identity.organization.management.service.OrganizationManager;
@@ -30,6 +31,7 @@ public class OrganizationManagementServiceHolder {
private OrgApplicationManager orgApplicationManager;
private OrganizationManager organizationManager;
+ private OrganizationDiscoveryManager organizationDiscoveryManager;
private OrganizationManagementServiceHolder() {
@@ -79,4 +81,24 @@ public void setOrganizationManager(OrganizationManager organizationManager) {
OrganizationManagementServiceHolder.getInstance().organizationManager = organizationManager;
}
+
+ /**
+ * Get OrganizationDiscoveryManager OSGi service.
+ *
+ * @return OrganizationDiscoveryManager.
+ */
+ public OrganizationDiscoveryManager getOrganizationDiscoveryManager() {
+
+ return OrganizationManagementServiceHolder.getInstance().organizationDiscoveryManager;
+ }
+
+ /**
+ * Set OrganizationDiscoveryManager OSGi service.
+ *
+ * @param organizationDiscoveryManager OrganizationDiscoveryManager.
+ */
+ public void setOrganizationDiscoveryManager(OrganizationDiscoveryManager organizationDiscoveryManager) {
+
+ OrganizationManagementServiceHolder.getInstance().organizationDiscoveryManager = organizationDiscoveryManager;
+ }
}
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/management/common/factory/OrganizationDiscoveryManagementOSGIServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/management/common/factory/OrganizationDiscoveryManagementOSGIServiceFactory.java
new file mode 100644
index 0000000000..603cbff06b
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/management/common/factory/OrganizationDiscoveryManagementOSGIServiceFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2023, 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.management.common.factory;
+
+import org.springframework.beans.factory.config.AbstractFactoryBean;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
+import org.wso2.carbon.identity.organization.discovery.service.OrganizationDiscoveryManager;
+
+/**
+ * Factory Beans serves as a factory for creating other beans within the IOC container. This factory bean is used to
+ * instantiate the OrganizationDiscoveryManager type of object inside the container.
+ */
+public class OrganizationDiscoveryManagementOSGIServiceFactory extends
+ AbstractFactoryBean {
+
+ private OrganizationDiscoveryManager organizationDiscoveryManager;
+
+ @Override
+ public Class> getObjectType() {
+
+ return Object.class;
+ }
+
+ @Override
+ protected OrganizationDiscoveryManager createInstance() throws Exception {
+
+ if (this.organizationDiscoveryManager == null) {
+ OrganizationDiscoveryManager service = (OrganizationDiscoveryManager) PrivilegedCarbonContext.
+ getThreadLocalCarbonContext().getOSGiService(OrganizationDiscoveryManager.class, null);
+ if (service == null) {
+ throw new Exception("Unable to retrieve OrganizationDiscoveryManager service.");
+ }
+ this.organizationDiscoveryManager = service;
+ }
+ return this.organizationDiscoveryManager;
+ }
+}
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/pom.xml
index 5fdbc3e9d3..2eedde41c4 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/pom.xml
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/pom.xml
@@ -102,6 +102,10 @@
org.wso2.carbon.identity.organization.management
org.wso2.carbon.identity.organization.management.application
+
+ org.wso2.carbon.identity.organization.management
+ org.wso2.carbon.identity.organization.discovery.service
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApi.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApi.java
index e2a378301e..e648349348 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApi.java
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApi.java
@@ -28,12 +28,18 @@
import org.wso2.carbon.identity.api.server.organization.management.v1.model.Error;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.GetOrganizationResponse;
import java.util.List;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryAttributes;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryCheckPOSTRequest;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryCheckPOSTResponse;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryPostRequest;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationMetadata;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationNameCheckPOSTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationNameCheckPOSTResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPOSTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPUTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPatchRequestItem;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationResponse;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationsDiscoveryResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationsResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.SharedApplicationsResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.SharedOrganizationsResponse;
@@ -54,6 +60,100 @@ public class OrganizationsApi {
@Autowired
private OrganizationsApiService delegate;
+ @Valid
+ @POST
+ @Path("/check-discovery")
+ @Consumes({ "application/json" })
+ @Produces({ "application/json" })
+ @ApiOperation(value = "Check whether given discovery attribute exists among the organization hierarchy.", notes = "This API is used to verify whether a specific discovery attribute has already been associated with an organization within the hierarchy. It is available for use within any organization in the hierarchy.
Permission required:
* /permission/admin/manage/identity/organizationmgt/view
Scope required:
* internal_organization_view", response = OrganizationDiscoveryCheckPOSTResponse.class, authorizations = {
+ @Authorization(value = "BasicAuth"),
+ @Authorization(value = "OAuth2", scopes = {
+
+ })
+ }, tags={ "Organization Discovery", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Successful response", response = OrganizationDiscoveryCheckPOSTResponse.class),
+ @ApiResponse(code = 404, message = "Requested resource is not found.", response = Error.class),
+ @ApiResponse(code = 400, message = "Invalid input in the request.", response = Error.class),
+ @ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class),
+ @ApiResponse(code = 403, message = "Access forbidden.", response = Void.class),
+ @ApiResponse(code = 500, message = "Internal server error.", response = Error.class)
+ })
+ public Response organizationCheckDiscovery(@ApiParam(value = "" ,required=true) @Valid OrganizationDiscoveryCheckPOSTRequest organizationDiscoveryCheckPOSTRequest) {
+
+ return delegate.organizationCheckDiscovery(organizationDiscoveryCheckPOSTRequest );
+ }
+
+ @Valid
+ @GET
+ @Path("/{organization-id}/discovery")
+
+ @Produces({ "application/json" })
+ @ApiOperation(value = "Get discovery attributes of the organization.", notes = "This API facilitates the retrieval of discovery attributes for an organization. It currently provides the capability to retrieve these attributes only from the primary organization.
Permission required:
* /permission/admin/manage/identity/organizationmgt/view
Scope required:
* internal_organization_view", response = OrganizationDiscoveryAttributes.class, authorizations = {
+ @Authorization(value = "BasicAuth"),
+ @Authorization(value = "OAuth2", scopes = {
+
+ })
+ }, tags={ "Organization Discovery", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Successful response", response = OrganizationDiscoveryAttributes.class),
+ @ApiResponse(code = 400, message = "Invalid input in the request.", response = Error.class),
+ @ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class),
+ @ApiResponse(code = 403, message = "Access forbidden.", response = Void.class),
+ @ApiResponse(code = 404, message = "Requested resource is not found.", response = Error.class),
+ @ApiResponse(code = 500, message = "Internal server error.", response = Error.class),
+ @ApiResponse(code = 501, message = "Not Implemented.", response = Error.class)
+ })
+ public Response organizationDiscoveryGet(@ApiParam(value = "ID of the organization whose discovery attributes are to be fetched.",required=true) @PathParam("organization-id") String organizationId) {
+
+ return delegate.organizationDiscoveryGet(organizationId );
+ }
+
+ @Valid
+ @POST
+ @Path("/discovery")
+ @Consumes({ "application/json" })
+ @Produces({ "application/json" })
+ @ApiOperation(value = "Map discovery attributes to the organization.", notes = "This API serves the purpose of adding discovery attributes to an organization, with the current restriction that only the primary organization has the capability to perform this action.
Permission required:
* /permission/admin/manage/identity/organizationmgt/update
Scope required:
* internal_organization_update", response = OrganizationDiscoveryAttributes.class, authorizations = {
+ @Authorization(value = "BasicAuth"),
+ @Authorization(value = "OAuth2", scopes = {
+
+ })
+ }, tags={ "Organization Discovery", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 201, message = "Successful response", response = OrganizationDiscoveryAttributes.class),
+ @ApiResponse(code = 400, message = "Invalid input in the request.", response = Error.class),
+ @ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class),
+ @ApiResponse(code = 403, message = "Access forbidden.", response = Void.class),
+ @ApiResponse(code = 500, message = "Internal server error.", response = Error.class)
+ })
+ public Response organizationDiscoveryPost(@ApiParam(value = "This represents the organization discovery attributes to be added." ,required=true) @Valid OrganizationDiscoveryPostRequest organizationDiscoveryPostRequest) {
+
+ return delegate.organizationDiscoveryPost(organizationDiscoveryPostRequest );
+ }
+
+ @Valid
+ @GET
+ @Path("/metadata")
+
+ @Produces({ "application/json" })
+ @ApiOperation(value = "Get metadata of the logged in organization.", notes = "This API facilitates the retrieval of metadata including discovery attributes of the logged in organization.
Permission required:
* /permission/admin/manage/identity/organizationmgt/view
Scope required:
* internal_organization_view", response = OrganizationMetadata.class, authorizations = {
+ @Authorization(value = "BasicAuth"),
+ @Authorization(value = "OAuth2", scopes = {
+
+ })
+ }, tags={ "Organization Metadata", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Successful response", response = OrganizationMetadata.class),
+ @ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class),
+ @ApiResponse(code = 403, message = "Access forbidden.", response = Void.class),
+ @ApiResponse(code = 500, message = "Internal server error.", response = Error.class)
+ })
+ public Response organizationMetadataGet() {
+
+ return delegate.organizationMetadataGet();
+ }
+
@Valid
@POST
@@ -101,6 +201,30 @@ public Response organizationsCheckNamePost(@ApiParam(value = "OrganizationNameCh
return delegate.organizationsCheckNamePost(organizationNameCheckPOSTRequest );
}
+ @Valid
+ @GET
+ @Path("/discovery")
+
+ @Produces({ "application/json" })
+ @ApiOperation(value = "Get discovery attributes of organizations.", notes = "This API facilitates the retrieval of discovery attributes of organizations in the hierarchy, allowing filtering by discovery attribute type and value. It currently provides the capability to retrieve these attributes from only the primary organization.
Permission required:
* /permission/admin/manage/identity/organizationmgt/view
Scope required:
* internal_organization_view", response = OrganizationsDiscoveryResponse.class, authorizations = {
+ @Authorization(value = "BasicAuth"),
+ @Authorization(value = "OAuth2", scopes = {
+
+ })
+ }, tags={ "Organization Discovery", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Successful response", response = OrganizationsDiscoveryResponse.class),
+ @ApiResponse(code = 400, message = "Invalid input in the request.", response = Error.class),
+ @ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class),
+ @ApiResponse(code = 403, message = "Access forbidden.", response = Void.class),
+ @ApiResponse(code = 500, message = "Internal server error.", response = Error.class),
+ @ApiResponse(code = 501, message = "Not Implemented.", response = Error.class)
+ })
+ public Response organizationsDiscoveryGet( @Valid@ApiParam(value = "Condition to filter the retrieval of records.") @QueryParam("filter") String filter, @Valid @Min(0)@ApiParam(value = "Number of records to skip for pagination.") @QueryParam("offset") Integer offset, @Valid @Min(0)@ApiParam(value = "Maximum number of records to be returned. (Should be greater than 0)") @QueryParam("limit") Integer limit) {
+
+ return delegate.organizationsDiscoveryGet(filter, offset, limit );
+ }
+
@Valid
@GET
@@ -173,6 +297,54 @@ public Response organizationsOrganizationIdDelete(@ApiParam(value = "ID of the o
return delegate.organizationsOrganizationIdDelete(organizationId );
}
+ @Valid
+ @DELETE
+ @Path("/{organization-id}/discovery")
+
+ @Produces({ "application/json" })
+ @ApiOperation(value = "Delete discovery attributes of an organization.", notes = "This API serves the purpose of deleting discovery attributes of an organization, with the current restriction that only the primary organization has the capability to perform this action.
Permission required:
* /permission/admin/manage/identity/organizationmgt/update
Scope required:
* internal_organization_update", response = Void.class, authorizations = {
+ @Authorization(value = "BasicAuth"),
+ @Authorization(value = "OAuth2", scopes = {
+
+ })
+ }, tags={ "Organization Discovery", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 204, message = "Successfully deleted", response = Void.class),
+ @ApiResponse(code = 400, message = "Invalid input in the request.", response = Error.class),
+ @ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class),
+ @ApiResponse(code = 403, message = "Access forbidden.", response = Void.class),
+ @ApiResponse(code = 404, message = "Requested resource is not found.", response = Error.class),
+ @ApiResponse(code = 500, message = "Internal server error.", response = Error.class)
+ })
+ public Response organizationsOrganizationIdDiscoveryDelete(@ApiParam(value = "ID of the organization whose discovery attributes are to be deleted.",required=true) @PathParam("organization-id") String organizationId) {
+
+ return delegate.organizationsOrganizationIdDiscoveryDelete(organizationId );
+ }
+
+ @Valid
+ @PUT
+ @Path("/{organization-id}/discovery")
+ @Consumes({ "application/json" })
+ @Produces({ "application/json" })
+ @ApiOperation(value = "Update discovery attributes of an organization.", notes = "This API serves the purpose of updating discovery attributes of an organization, with the current restriction that only the primary organization has the capability to perform this action.
Permission required:
* /permission/admin/manage/identity/organizationmgt/update
Scope required:
* internal_organization_update", response = OrganizationDiscoveryAttributes.class, authorizations = {
+ @Authorization(value = "BasicAuth"),
+ @Authorization(value = "OAuth2", scopes = {
+
+ })
+ }, tags={ "Organization Discovery", })
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Successful response", response = OrganizationDiscoveryAttributes.class),
+ @ApiResponse(code = 400, message = "Invalid input in the request.", response = Error.class),
+ @ApiResponse(code = 401, message = "Authentication information is missing or invalid.", response = Void.class),
+ @ApiResponse(code = 403, message = "Access forbidden.", response = Void.class),
+ @ApiResponse(code = 404, message = "Requested resource is not found.", response = Error.class),
+ @ApiResponse(code = 500, message = "Internal server error.", response = Error.class)
+ })
+ public Response organizationsOrganizationIdDiscoveryPut(@ApiParam(value = "ID of the organization whose discovery attributes are to be updated.",required=true) @PathParam("organization-id") String organizationId, @ApiParam(value = "" ,required=true) @Valid OrganizationDiscoveryAttributes organizationDiscoveryAttributes) {
+
+ return delegate.organizationsOrganizationIdDiscoveryPut(organizationId, organizationDiscoveryAttributes );
+ }
+
@Valid
@GET
@Path("/{organization-id}")
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApiService.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApiService.java
index 9904657f54..0fefb8bbb1 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApiService.java
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/OrganizationsApiService.java
@@ -28,12 +28,18 @@
import org.wso2.carbon.identity.api.server.organization.management.v1.model.Error;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.GetOrganizationResponse;
import java.util.List;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryAttributes;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryCheckPOSTRequest;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryCheckPOSTResponse;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryPostRequest;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationMetadata;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationNameCheckPOSTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationNameCheckPOSTResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPOSTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPUTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPatchRequestItem;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationResponse;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationsDiscoveryResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationsResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.SharedApplicationsResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.SharedOrganizationsResponse;
@@ -42,16 +48,30 @@
public interface OrganizationsApiService {
+ public Response organizationCheckDiscovery(OrganizationDiscoveryCheckPOSTRequest organizationDiscoveryCheckPOSTRequest);
+
+ public Response organizationDiscoveryGet(String organizationId);
+
+ public Response organizationDiscoveryPost(OrganizationDiscoveryPostRequest organizationDiscoveryPostRequest);
+
+ public Response organizationMetadataGet();
+
public Response organizationPost(OrganizationPOSTRequest organizationPOSTRequest);
public Response organizationsCheckNamePost(OrganizationNameCheckPOSTRequest organizationNameCheckPOSTRequest);
+ public Response organizationsDiscoveryGet(String filter, Integer offset, Integer limit);
+
public Response organizationsGet(String filter, Integer limit, String after, String before, Boolean recursive);
public Response organizationsGetMe(String filter, Integer limit, String after, String before, Boolean recursive);
public Response organizationsOrganizationIdDelete(String organizationId);
+ public Response organizationsOrganizationIdDiscoveryDelete(String organizationId);
+
+ public Response organizationsOrganizationIdDiscoveryPut(String organizationId, OrganizationDiscoveryAttributes organizationDiscoveryAttributes);
+
public Response organizationsOrganizationIdGet(String organizationId, Boolean includePermissions);
public Response organizationsOrganizationIdPatch(String organizationId, List organizationPatchRequestItem);
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/DiscoveryAttribute.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/DiscoveryAttribute.java
new file mode 100644
index 0000000000..a66ac85385
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/DiscoveryAttribute.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2023, 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.management.v1.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.validation.constraints.*;
+
+
+import io.swagger.annotations.*;
+import java.util.Objects;
+import javax.validation.Valid;
+import javax.xml.bind.annotation.*;
+
+public class DiscoveryAttribute {
+
+ private String type;
+ private List values = null;
+
+
+ /**
+ **/
+ public DiscoveryAttribute type(String type) {
+
+ this.type = type;
+ return this;
+ }
+
+ @ApiModelProperty(example = "emailDomain", required = true, value = "")
+ @JsonProperty("type")
+ @Valid
+ @NotNull(message = "Property type cannot be null.")
+
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ **/
+ public DiscoveryAttribute values(List values) {
+
+ this.values = values;
+ return this;
+ }
+
+ @ApiModelProperty(value = "")
+ @JsonProperty("values")
+ @Valid
+ public List getValues() {
+ return values;
+ }
+ public void setValues(List values) {
+ this.values = values;
+ }
+
+ public DiscoveryAttribute addValuesItem(String valuesItem) {
+ if (this.values == null) {
+ this.values = new ArrayList<>();
+ }
+ this.values.add(valuesItem);
+ return this;
+ }
+
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DiscoveryAttribute discoveryAttribute = (DiscoveryAttribute) o;
+ return Objects.equals(this.type, discoveryAttribute.type) &&
+ Objects.equals(this.values, discoveryAttribute.values);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, values);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class DiscoveryAttribute {\n");
+
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" values: ").append(toIndentedString(values)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n");
+ }
+}
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryAttributes.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryAttributes.java
new file mode 100644
index 0000000000..b200b9eafd
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryAttributes.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2023, 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.management.v1.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.List;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.DiscoveryAttribute;
+import javax.validation.constraints.*;
+
+
+import io.swagger.annotations.*;
+import java.util.Objects;
+import javax.validation.Valid;
+import javax.xml.bind.annotation.*;
+
+public class OrganizationDiscoveryAttributes {
+
+ private List attributes = new ArrayList<>();
+
+
+ /**
+ **/
+ public OrganizationDiscoveryAttributes attributes(List attributes) {
+
+ this.attributes = attributes;
+ return this;
+ }
+
+ @ApiModelProperty(required = true, value = "")
+ @JsonProperty("attributes")
+ @Valid
+ @NotNull(message = "Property attributes cannot be null.")
+
+ public List getAttributes() {
+ return attributes;
+ }
+ public void setAttributes(List attributes) {
+ this.attributes = attributes;
+ }
+
+ public OrganizationDiscoveryAttributes addAttributesItem(DiscoveryAttribute attributesItem) {
+ this.attributes.add(attributesItem);
+ return this;
+ }
+
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OrganizationDiscoveryAttributes organizationDiscoveryAttributes = (OrganizationDiscoveryAttributes) o;
+ return Objects.equals(this.attributes, organizationDiscoveryAttributes.attributes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(attributes);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrganizationDiscoveryAttributes {\n");
+
+ sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n");
+ }
+}
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryCheckPOSTRequest.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryCheckPOSTRequest.java
new file mode 100644
index 0000000000..7a7afe7bf1
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryCheckPOSTRequest.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2023, 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.management.v1.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import javax.validation.constraints.*;
+
+
+import io.swagger.annotations.*;
+import java.util.Objects;
+import javax.validation.Valid;
+import javax.xml.bind.annotation.*;
+
+public class OrganizationDiscoveryCheckPOSTRequest {
+
+ private String type;
+ private String value;
+
+ /**
+ **/
+ public OrganizationDiscoveryCheckPOSTRequest type(String type) {
+
+ this.type = type;
+ return this;
+ }
+
+ @ApiModelProperty(example = "emailDomain", required = true, value = "")
+ @JsonProperty("type")
+ @Valid
+ @NotNull(message = "Property type cannot be null.")
+
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ **/
+ public OrganizationDiscoveryCheckPOSTRequest value(String value) {
+
+ this.value = value;
+ return this;
+ }
+
+ @ApiModelProperty(example = "abc.com", required = true, value = "")
+ @JsonProperty("value")
+ @Valid
+ @NotNull(message = "Property value cannot be null.")
+
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OrganizationDiscoveryCheckPOSTRequest organizationDiscoveryCheckPOSTRequest = (OrganizationDiscoveryCheckPOSTRequest) o;
+ return Objects.equals(this.type, organizationDiscoveryCheckPOSTRequest.type) &&
+ Objects.equals(this.value, organizationDiscoveryCheckPOSTRequest.value);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, value);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrganizationDiscoveryCheckPOSTRequest {\n");
+
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" value: ").append(toIndentedString(value)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n");
+ }
+}
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryCheckPOSTResponse.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryCheckPOSTResponse.java
new file mode 100644
index 0000000000..fa5c262f15
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryCheckPOSTResponse.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2023, 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.management.v1.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import javax.validation.constraints.*;
+
+
+import io.swagger.annotations.*;
+import java.util.Objects;
+import javax.validation.Valid;
+import javax.xml.bind.annotation.*;
+
+public class OrganizationDiscoveryCheckPOSTResponse {
+
+ private Boolean available;
+
+ /**
+ **/
+ public OrganizationDiscoveryCheckPOSTResponse available(Boolean available) {
+
+ this.available = available;
+ return this;
+ }
+
+ @ApiModelProperty(example = "true", required = true, value = "")
+ @JsonProperty("available")
+ @Valid
+ @NotNull(message = "Property available cannot be null.")
+
+ public Boolean getAvailable() {
+ return available;
+ }
+ public void setAvailable(Boolean available) {
+ this.available = available;
+ }
+
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OrganizationDiscoveryCheckPOSTResponse organizationDiscoveryCheckPOSTResponse = (OrganizationDiscoveryCheckPOSTResponse) o;
+ return Objects.equals(this.available, organizationDiscoveryCheckPOSTResponse.available);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(available);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrganizationDiscoveryCheckPOSTResponse {\n");
+
+ sb.append(" available: ").append(toIndentedString(available)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n");
+ }
+}
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryPostRequest.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryPostRequest.java
new file mode 100644
index 0000000000..cdf8006aba
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryPostRequest.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2023, 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.management.v1.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.List;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.DiscoveryAttribute;
+import javax.validation.constraints.*;
+
+
+import io.swagger.annotations.*;
+import java.util.Objects;
+import javax.validation.Valid;
+import javax.xml.bind.annotation.*;
+
+public class OrganizationDiscoveryPostRequest {
+
+ private String organizationId;
+ private List attributes = new ArrayList<>();
+
+
+ /**
+ * The ID of the organization whose discovery attributes are to be added.
+ **/
+ public OrganizationDiscoveryPostRequest organizationId(String organizationId) {
+
+ this.organizationId = organizationId;
+ return this;
+ }
+
+ @ApiModelProperty(example = "06c1f4e2-3339-44e4-a825-96585e3653b1", required = true, value = "The ID of the organization whose discovery attributes are to be added.")
+ @JsonProperty("organizationId")
+ @Valid
+ @NotNull(message = "Property organizationId cannot be null.")
+
+ public String getOrganizationId() {
+ return organizationId;
+ }
+ public void setOrganizationId(String organizationId) {
+ this.organizationId = organizationId;
+ }
+
+ /**
+ **/
+ public OrganizationDiscoveryPostRequest attributes(List attributes) {
+
+ this.attributes = attributes;
+ return this;
+ }
+
+ @ApiModelProperty(required = true, value = "")
+ @JsonProperty("attributes")
+ @Valid
+ @NotNull(message = "Property attributes cannot be null.")
+
+ public List getAttributes() {
+ return attributes;
+ }
+ public void setAttributes(List attributes) {
+ this.attributes = attributes;
+ }
+
+ public OrganizationDiscoveryPostRequest addAttributesItem(DiscoveryAttribute attributesItem) {
+ this.attributes.add(attributesItem);
+ return this;
+ }
+
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OrganizationDiscoveryPostRequest organizationDiscoveryPostRequest = (OrganizationDiscoveryPostRequest) o;
+ return Objects.equals(this.organizationId, organizationDiscoveryPostRequest.organizationId) &&
+ Objects.equals(this.attributes, organizationDiscoveryPostRequest.attributes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(organizationId, attributes);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrganizationDiscoveryPostRequest {\n");
+
+ sb.append(" organizationId: ").append(toIndentedString(organizationId)).append("\n");
+ sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n");
+ }
+}
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryResponse.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryResponse.java
new file mode 100644
index 0000000000..6bc74dd741
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationDiscoveryResponse.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2023, 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.management.v1.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.List;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.DiscoveryAttribute;
+import javax.validation.constraints.*;
+
+
+import io.swagger.annotations.*;
+import java.util.Objects;
+import javax.validation.Valid;
+import javax.xml.bind.annotation.*;
+
+public class OrganizationDiscoveryResponse {
+
+ private String organizationId;
+ private List attributes = new ArrayList<>();
+
+
+ /**
+ * The ID of the organization.
+ **/
+ public OrganizationDiscoveryResponse organizationId(String organizationId) {
+
+ this.organizationId = organizationId;
+ return this;
+ }
+
+ @ApiModelProperty(example = "06c1f4e2-3339-44e4-a825-96585e3653b1", required = true, value = "The ID of the organization.")
+ @JsonProperty("organizationId")
+ @Valid
+ @NotNull(message = "Property organizationId cannot be null.")
+
+ public String getOrganizationId() {
+ return organizationId;
+ }
+ public void setOrganizationId(String organizationId) {
+ this.organizationId = organizationId;
+ }
+
+ /**
+ **/
+ public OrganizationDiscoveryResponse attributes(List attributes) {
+
+ this.attributes = attributes;
+ return this;
+ }
+
+ @ApiModelProperty(required = true, value = "")
+ @JsonProperty("attributes")
+ @Valid
+ @NotNull(message = "Property attributes cannot be null.")
+
+ public List getAttributes() {
+ return attributes;
+ }
+ public void setAttributes(List attributes) {
+ this.attributes = attributes;
+ }
+
+ public OrganizationDiscoveryResponse addAttributesItem(DiscoveryAttribute attributesItem) {
+ this.attributes.add(attributesItem);
+ return this;
+ }
+
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OrganizationDiscoveryResponse organizationDiscoveryResponse = (OrganizationDiscoveryResponse) o;
+ return Objects.equals(this.organizationId, organizationDiscoveryResponse.organizationId) &&
+ Objects.equals(this.attributes, organizationDiscoveryResponse.attributes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(organizationId, attributes);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrganizationDiscoveryResponse {\n");
+
+ sb.append(" organizationId: ").append(toIndentedString(organizationId)).append("\n");
+ sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n");
+ }
+}
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationMetadata.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationMetadata.java
new file mode 100644
index 0000000000..4f96a842b9
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationMetadata.java
@@ -0,0 +1,418 @@
+/*
+ * Copyright (c) 2023, 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.management.v1.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.List;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.Attribute;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.DiscoveryAttribute;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.ParentOrganization;
+import javax.validation.constraints.*;
+
+
+import io.swagger.annotations.*;
+import java.util.Objects;
+import javax.validation.Valid;
+import javax.xml.bind.annotation.*;
+
+public class OrganizationMetadata {
+
+ private String id;
+ private String name;
+ private String description;
+
+@XmlType(name="StatusEnum")
+@XmlEnum(String.class)
+public enum StatusEnum {
+
+ @XmlEnumValue("ACTIVE") ACTIVE(String.valueOf("ACTIVE")), @XmlEnumValue("DISABLED") DISABLED(String.valueOf("DISABLED"));
+
+
+ private String value;
+
+ StatusEnum(String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ public static StatusEnum fromValue(String value) {
+ for (StatusEnum b : StatusEnum.values()) {
+ if (b.value.equals(value)) {
+ return b;
+ }
+ }
+ throw new IllegalArgumentException("Unexpected value '" + value + "'");
+ }
+}
+
+ private StatusEnum status;
+ private String created;
+ private String lastModified;
+
+@XmlType(name="TypeEnum")
+@XmlEnum(String.class)
+public enum TypeEnum {
+
+ @XmlEnumValue("TENANT") TENANT(String.valueOf("TENANT")), @XmlEnumValue("STRUCTURAL") STRUCTURAL(String.valueOf("STRUCTURAL"));
+
+
+ private String value;
+
+ TypeEnum(String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ public static TypeEnum fromValue(String value) {
+ for (TypeEnum b : TypeEnum.values()) {
+ if (b.value.equals(value)) {
+ return b;
+ }
+ }
+ throw new IllegalArgumentException("Unexpected value '" + value + "'");
+ }
+}
+
+ private TypeEnum type;
+ private ParentOrganization parent;
+ private List attributes = null;
+
+ private List permissions = null;
+
+ private List discoveryAttributes = null;
+
+
+ /**
+ **/
+ public OrganizationMetadata id(String id) {
+
+ this.id = id;
+ return this;
+ }
+
+ @ApiModelProperty(example = "06c1f4e2-3339-44e4-a825-96585e3653b1", required = true, value = "")
+ @JsonProperty("id")
+ @Valid
+ @NotNull(message = "Property id cannot be null.")
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata name(String name) {
+
+ this.name = name;
+ return this;
+ }
+
+ @ApiModelProperty(example = "ABC Builders", required = true, value = "")
+ @JsonProperty("name")
+ @Valid
+ @NotNull(message = "Property name cannot be null.")
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata description(String description) {
+
+ this.description = description;
+ return this;
+ }
+
+ @ApiModelProperty(example = "Building constructions", value = "")
+ @JsonProperty("description")
+ @Valid
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata status(StatusEnum status) {
+
+ this.status = status;
+ return this;
+ }
+
+ @ApiModelProperty(example = "ACTIVE", required = true, value = "")
+ @JsonProperty("status")
+ @Valid
+ @NotNull(message = "Property status cannot be null.")
+
+ public StatusEnum getStatus() {
+ return status;
+ }
+ public void setStatus(StatusEnum status) {
+ this.status = status;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata created(String created) {
+
+ this.created = created;
+ return this;
+ }
+
+ @ApiModelProperty(example = "2021-10-25T12:31:53.406Z", required = true, value = "")
+ @JsonProperty("created")
+ @Valid
+ @NotNull(message = "Property created cannot be null.")
+
+ public String getCreated() {
+ return created;
+ }
+ public void setCreated(String created) {
+ this.created = created;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata lastModified(String lastModified) {
+
+ this.lastModified = lastModified;
+ return this;
+ }
+
+ @ApiModelProperty(example = "2021-10-25T12:31:53.406Z", required = true, value = "")
+ @JsonProperty("lastModified")
+ @Valid
+ @NotNull(message = "Property lastModified cannot be null.")
+
+ public String getLastModified() {
+ return lastModified;
+ }
+ public void setLastModified(String lastModified) {
+ this.lastModified = lastModified;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata type(TypeEnum type) {
+
+ this.type = type;
+ return this;
+ }
+
+ @ApiModelProperty(example = "TENANT", required = true, value = "")
+ @JsonProperty("type")
+ @Valid
+ @NotNull(message = "Property type cannot be null.")
+
+ public TypeEnum getType() {
+ return type;
+ }
+ public void setType(TypeEnum type) {
+ this.type = type;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata parent(ParentOrganization parent) {
+
+ this.parent = parent;
+ return this;
+ }
+
+ @ApiModelProperty(value = "")
+ @JsonProperty("parent")
+ @Valid
+ public ParentOrganization getParent() {
+ return parent;
+ }
+ public void setParent(ParentOrganization parent) {
+ this.parent = parent;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata attributes(List attributes) {
+
+ this.attributes = attributes;
+ return this;
+ }
+
+ @ApiModelProperty(value = "")
+ @JsonProperty("attributes")
+ @Valid
+ public List getAttributes() {
+ return attributes;
+ }
+ public void setAttributes(List attributes) {
+ this.attributes = attributes;
+ }
+
+ public OrganizationMetadata addAttributesItem(Attribute attributesItem) {
+ if (this.attributes == null) {
+ this.attributes = new ArrayList<>();
+ }
+ this.attributes.add(attributesItem);
+ return this;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata permissions(List permissions) {
+
+ this.permissions = permissions;
+ return this;
+ }
+
+ @ApiModelProperty(value = "")
+ @JsonProperty("permissions")
+ @Valid
+ public List getPermissions() {
+ return permissions;
+ }
+ public void setPermissions(List permissions) {
+ this.permissions = permissions;
+ }
+
+ public OrganizationMetadata addPermissionsItem(String permissionsItem) {
+ if (this.permissions == null) {
+ this.permissions = new ArrayList<>();
+ }
+ this.permissions.add(permissionsItem);
+ return this;
+ }
+
+ /**
+ **/
+ public OrganizationMetadata discoveryAttributes(List discoveryAttributes) {
+
+ this.discoveryAttributes = discoveryAttributes;
+ return this;
+ }
+
+ @ApiModelProperty(value = "")
+ @JsonProperty("discoveryAttributes")
+ @Valid
+ public List getDiscoveryAttributes() {
+ return discoveryAttributes;
+ }
+ public void setDiscoveryAttributes(List discoveryAttributes) {
+ this.discoveryAttributes = discoveryAttributes;
+ }
+
+ public OrganizationMetadata addDiscoveryAttributesItem(DiscoveryAttribute discoveryAttributesItem) {
+ if (this.discoveryAttributes == null) {
+ this.discoveryAttributes = new ArrayList<>();
+ }
+ this.discoveryAttributes.add(discoveryAttributesItem);
+ return this;
+ }
+
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OrganizationMetadata organizationMetadata = (OrganizationMetadata) o;
+ return Objects.equals(this.id, organizationMetadata.id) &&
+ Objects.equals(this.name, organizationMetadata.name) &&
+ Objects.equals(this.description, organizationMetadata.description) &&
+ Objects.equals(this.status, organizationMetadata.status) &&
+ Objects.equals(this.created, organizationMetadata.created) &&
+ Objects.equals(this.lastModified, organizationMetadata.lastModified) &&
+ Objects.equals(this.type, organizationMetadata.type) &&
+ Objects.equals(this.parent, organizationMetadata.parent) &&
+ Objects.equals(this.attributes, organizationMetadata.attributes) &&
+ Objects.equals(this.permissions, organizationMetadata.permissions) &&
+ Objects.equals(this.discoveryAttributes, organizationMetadata.discoveryAttributes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, name, description, status, created, lastModified, type, parent, attributes, permissions, discoveryAttributes);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrganizationMetadata {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" name: ").append(toIndentedString(name)).append("\n");
+ sb.append(" description: ").append(toIndentedString(description)).append("\n");
+ sb.append(" status: ").append(toIndentedString(status)).append("\n");
+ sb.append(" created: ").append(toIndentedString(created)).append("\n");
+ sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" parent: ").append(toIndentedString(parent)).append("\n");
+ sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
+ sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n");
+ sb.append(" discoveryAttributes: ").append(toIndentedString(discoveryAttributes)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n");
+ }
+}
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationsDiscoveryResponse.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationsDiscoveryResponse.java
new file mode 100644
index 0000000000..1517446619
--- /dev/null
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/management/v1/model/OrganizationsDiscoveryResponse.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2023, 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.management.v1.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.List;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.Link;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryResponse;
+import javax.validation.constraints.*;
+
+
+import io.swagger.annotations.*;
+import java.util.Objects;
+import javax.validation.Valid;
+import javax.xml.bind.annotation.*;
+
+public class OrganizationsDiscoveryResponse {
+
+ private Integer totalResults;
+ private Integer startIndex;
+ private Integer count;
+ private List links = null;
+
+ private List organizations = null;
+
+
+ /**
+ **/
+ public OrganizationsDiscoveryResponse totalResults(Integer totalResults) {
+
+ this.totalResults = totalResults;
+ return this;
+ }
+
+ @ApiModelProperty(example = "10", value = "")
+ @JsonProperty("totalResults")
+ @Valid
+ public Integer getTotalResults() {
+ return totalResults;
+ }
+ public void setTotalResults(Integer totalResults) {
+ this.totalResults = totalResults;
+ }
+
+ /**
+ **/
+ public OrganizationsDiscoveryResponse startIndex(Integer startIndex) {
+
+ this.startIndex = startIndex;
+ return this;
+ }
+
+ @ApiModelProperty(example = "1", value = "")
+ @JsonProperty("startIndex")
+ @Valid
+ public Integer getStartIndex() {
+ return startIndex;
+ }
+ public void setStartIndex(Integer startIndex) {
+ this.startIndex = startIndex;
+ }
+
+ /**
+ **/
+ public OrganizationsDiscoveryResponse count(Integer count) {
+
+ this.count = count;
+ return this;
+ }
+
+ @ApiModelProperty(example = "10", value = "")
+ @JsonProperty("count")
+ @Valid
+ public Integer getCount() {
+ return count;
+ }
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ /**
+ **/
+ public OrganizationsDiscoveryResponse links(List links) {
+
+ this.links = links;
+ return this;
+ }
+
+ @ApiModelProperty(example = "[{\"href\":\"/o/10084a8d-113f-4211-a0d5-efe36b082211/api/server/v1/organizations/discovery?filter=attributes.type+eq+emailDomain&limit=10&offset=50\",\"rel\":\"next\"},{\"href\":\"/o/10084a8d-113f-4211-a0d5-efe36b082211/api/server/v1/organizations/discovery?filter=attributes.type+eq+emailDomain&limit=10&offset=30\",\"rel\":\"previous\"}]", value = "")
+ @JsonProperty("links")
+ @Valid
+ public List getLinks() {
+ return links;
+ }
+ public void setLinks(List links) {
+ this.links = links;
+ }
+
+ public OrganizationsDiscoveryResponse addLinksItem(Link linksItem) {
+ if (this.links == null) {
+ this.links = new ArrayList<>();
+ }
+ this.links.add(linksItem);
+ return this;
+ }
+
+ /**
+ **/
+ public OrganizationsDiscoveryResponse organizations(List organizations) {
+
+ this.organizations = organizations;
+ return this;
+ }
+
+ @ApiModelProperty(value = "")
+ @JsonProperty("organizations")
+ @Valid
+ public List getOrganizations() {
+ return organizations;
+ }
+ public void setOrganizations(List organizations) {
+ this.organizations = organizations;
+ }
+
+ public OrganizationsDiscoveryResponse addOrganizationsItem(OrganizationDiscoveryResponse organizationsItem) {
+ if (this.organizations == null) {
+ this.organizations = new ArrayList<>();
+ }
+ this.organizations.add(organizationsItem);
+ return this;
+ }
+
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OrganizationsDiscoveryResponse organizationsDiscoveryResponse = (OrganizationsDiscoveryResponse) o;
+ return Objects.equals(this.totalResults, organizationsDiscoveryResponse.totalResults) &&
+ Objects.equals(this.startIndex, organizationsDiscoveryResponse.startIndex) &&
+ Objects.equals(this.count, organizationsDiscoveryResponse.count) &&
+ Objects.equals(this.links, organizationsDiscoveryResponse.links) &&
+ Objects.equals(this.organizations, organizationsDiscoveryResponse.organizations);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(totalResults, startIndex, count, links, organizations);
+ }
+
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrganizationsDiscoveryResponse {\n");
+
+ sb.append(" totalResults: ").append(toIndentedString(totalResults)).append("\n");
+ sb.append(" startIndex: ").append(toIndentedString(startIndex)).append("\n");
+ sb.append(" count: ").append(toIndentedString(count)).append("\n");
+ sb.append(" links: ").append(toIndentedString(links)).append("\n");
+ sb.append(" organizations: ").append(toIndentedString(organizations)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(java.lang.Object o) {
+
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n");
+ }
+}
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/constants/OrganizationManagementEndpointConstants.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/constants/OrganizationManagementEndpointConstants.java
index 371ec907dc..cb8506f3f6 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/constants/OrganizationManagementEndpointConstants.java
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/constants/OrganizationManagementEndpointConstants.java
@@ -25,4 +25,5 @@ public class OrganizationManagementEndpointConstants {
public static final String DESC_SORT_ORDER = "DESC";
public static final String ASC_SORT_ORDER = "ASC";
+ public static final String DISCOVERY_PATH = "discovery";
}
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/impl/OrganizationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/impl/OrganizationsApiServiceImpl.java
index eed247e7f3..54c32211b5 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/impl/OrganizationsApiServiceImpl.java
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/impl/OrganizationsApiServiceImpl.java
@@ -21,6 +21,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.wso2.carbon.identity.api.server.organization.management.v1.OrganizationsApiService;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.ApplicationSharePOSTRequest;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryAttributes;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryCheckPOSTRequest;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryPostRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationNameCheckPOSTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPOSTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPUTRequest;
@@ -51,6 +54,20 @@ public Response organizationsOrganizationIdDelete(String organizationId) {
return organizationManagementService.deleteOrganization(organizationId);
}
+ @Override
+ public Response organizationsOrganizationIdDiscoveryDelete(String organizationId) {
+
+ return organizationManagementService.deleteOrganizationDiscoveryAttributes(organizationId);
+ }
+
+ @Override
+ public Response organizationsOrganizationIdDiscoveryPut(String organizationId, OrganizationDiscoveryAttributes
+ organizationDiscoveryAttributes) {
+
+ return organizationManagementService.updateOrganizationDiscoveryAttributes(organizationId,
+ organizationDiscoveryAttributes);
+ }
+
@Override
public Response organizationsOrganizationIdGet(String organizationId, Boolean includePermissions) {
@@ -71,6 +88,31 @@ public Response organizationsOrganizationIdPut(String organizationId, Organizati
return organizationManagementService.updateOrganization(organizationId, organizationPUTRequest);
}
+ @Override
+ public Response organizationCheckDiscovery(
+ OrganizationDiscoveryCheckPOSTRequest organizationDiscoveryCheckPOSTRequest) {
+
+ return organizationManagementService.isDiscoveryAttributeAvailable(organizationDiscoveryCheckPOSTRequest);
+ }
+
+ @Override
+ public Response organizationDiscoveryGet(String organizationId) {
+
+ return organizationManagementService.getOrganizationDiscoveryAttributes(organizationId);
+ }
+
+ @Override
+ public Response organizationDiscoveryPost(OrganizationDiscoveryPostRequest organizationDiscoveryPostRequest) {
+
+ return organizationManagementService.addOrganizationDiscoveryAttributes(organizationDiscoveryPostRequest);
+ }
+
+ @Override
+ public Response organizationMetadataGet() {
+
+ return organizationManagementService.getOrganizationMetadata();
+ }
+
@Override
public Response organizationPost(OrganizationPOSTRequest organizationPOSTRequest) {
@@ -124,6 +166,12 @@ public Response organizationsCheckNamePost(OrganizationNameCheckPOSTRequest orga
return organizationManagementService.checkOrganizationName(organizationNameCheckPOSTRequest.getName());
}
+ @Override
+ public Response organizationsDiscoveryGet(String filter, Integer offset, Integer limit) {
+
+ return organizationManagementService.getOrganizationsDiscoveryAttributes(filter, offset, limit);
+ }
+
@Override
public Response organizationsGetMe(String filter, Integer limit, String after, String before, Boolean recursive) {
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/service/OrganizationManagementService.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/service/OrganizationManagementService.java
index 66a01f2be4..48bf4e0bff 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/service/OrganizationManagementService.java
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/service/OrganizationManagementService.java
@@ -28,14 +28,22 @@
import org.wso2.carbon.identity.api.server.organization.management.v1.model.ApplicationSharePOSTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.Attribute;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.BasicOrganizationResponse;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.DiscoveryAttribute;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.Error;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.GetOrganizationResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.Link;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryAttributes;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryCheckPOSTRequest;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryCheckPOSTResponse;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryPostRequest;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationDiscoveryResponse;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationMetadata;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationNameCheckPOSTResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPOSTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPUTRequest;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationPatchRequestItem;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationResponse;
+import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationsDiscoveryResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.OrganizationsResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.ParentOrganization;
import org.wso2.carbon.identity.api.server.organization.management.v1.model.SharedApplicationResponse;
@@ -43,6 +51,8 @@
import org.wso2.carbon.identity.api.server.organization.management.v1.model.SharedOrganizationsResponse;
import org.wso2.carbon.identity.api.server.organization.management.v1.util.OrganizationManagementEndpointUtil;
import org.wso2.carbon.identity.core.util.IdentityUtil;
+import org.wso2.carbon.identity.organization.discovery.service.OrganizationDiscoveryManager;
+import org.wso2.carbon.identity.organization.discovery.service.model.OrgDiscoveryAttribute;
import org.wso2.carbon.identity.organization.management.application.OrgApplicationManager;
import org.wso2.carbon.identity.organization.management.application.model.SharedApplication;
import org.wso2.carbon.identity.organization.management.service.OrganizationManager;
@@ -65,6 +75,8 @@
import java.util.Base64;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import javax.ws.rs.core.Response;
@@ -72,12 +84,15 @@
import static org.wso2.carbon.identity.api.server.organization.management.v1.constants.OrganizationManagementEndpointConstants.ASC_SORT_ORDER;
import static org.wso2.carbon.identity.api.server.organization.management.v1.constants.OrganizationManagementEndpointConstants.DESC_SORT_ORDER;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_ERROR_BUILDING_PAGINATED_RESPONSE_URL;
+import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_FILTERING_NOT_IMPLEMENTED;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_PAGINATION_PARAMETER_NEGATIVE_LIMIT;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_SHARE_APPLICATION_EMPTY_REQUEST_BODY;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_SHARE_APPLICATION_REQUEST_BODY;
+import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_PAGINATION_NOT_IMPLEMENTED;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.SUPER;
import static org.wso2.carbon.identity.organization.management.service.util.Utils.buildURIForBody;
import static org.wso2.carbon.identity.organization.management.service.util.Utils.generateUniqueID;
+import static org.wso2.carbon.identity.organization.management.service.util.Utils.getOrganizationId;
import static org.wso2.carbon.identity.organization.management.service.util.Utils.handleClientException;
/**
@@ -374,6 +389,168 @@ public Response getSharedApplications(String organizationId, String applicationI
}
}
+ /**
+ * Add discovery attributes for the given organization.
+ *
+ * @param organizationDiscoveryPostRequest Add organization discovery attributes request.
+ * @return The newly created discovery attributes of the organization.
+ */
+ public Response addOrganizationDiscoveryAttributes(OrganizationDiscoveryPostRequest
+ organizationDiscoveryPostRequest) {
+
+ try {
+ List orgDiscoveryAttributeList = getOrganizationDiscoveryManager()
+ .addOrganizationDiscoveryAttributes(organizationDiscoveryPostRequest.getOrganizationId(),
+ getOrgDiscoveryAttributesFromPostRequest(organizationDiscoveryPostRequest), true);
+ String organizationId = organizationDiscoveryPostRequest.getOrganizationId();
+ return Response.created(OrganizationManagementEndpointUtil.getDiscoveryResourceLocation(organizationId))
+ .entity(getOrganizationDiscoveryAttributesResponse(orgDiscoveryAttributeList)).build();
+ } catch (OrganizationManagementClientException e) {
+ return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG);
+ } catch (OrganizationManagementException e) {
+ return OrganizationManagementEndpointUtil.handleServerErrorResponse(e, LOG);
+ }
+ }
+
+ /**
+ * Fetch the discovery attributes of the given organization.
+ *
+ * @param organizationId The ID of the organization whose organization discovery attributes are to be fetched.
+ * @return The discovery attributes of the given organization.
+ */
+ public Response getOrganizationDiscoveryAttributes(String organizationId) {
+
+ try {
+ List orgDiscoveryAttributeList = getOrganizationDiscoveryManager()
+ .getOrganizationDiscoveryAttributes(organizationId, true);
+ return Response.ok().entity(getOrganizationDiscoveryAttributesResponse(orgDiscoveryAttributeList)).build();
+ } catch (OrganizationManagementClientException e) {
+ return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG);
+ } catch (OrganizationManagementException e) {
+ return OrganizationManagementEndpointUtil.handleServerErrorResponse(e, LOG);
+ }
+ }
+
+ /**
+ * Update the discovery attributes of the given organization.
+ *
+ * @param organizationId The ID of the organization whose organization discovery attributes are to
+ * be updated.
+ * @param organizationDiscoveryAttributes The organization discovery attributes.
+ * @return Organization discovery attribute update response.
+ */
+ public Response updateOrganizationDiscoveryAttributes(String organizationId, OrganizationDiscoveryAttributes
+ organizationDiscoveryAttributes) {
+
+ try {
+ List orgDiscoveryAttributeList = getOrganizationDiscoveryManager()
+ .updateOrganizationDiscoveryAttributes(organizationId,
+ getOrgDiscoveryAttributesFromPutRequest(organizationDiscoveryAttributes), true);
+ return Response.ok().entity(getOrganizationDiscoveryAttributesResponse(orgDiscoveryAttributeList)).build();
+ } catch (OrganizationManagementClientException e) {
+ return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG);
+ } catch (OrganizationManagementException e) {
+ return OrganizationManagementEndpointUtil.handleServerErrorResponse(e, LOG);
+ }
+ }
+
+ /**
+ * Delete the discovery attributes of the given organization.
+ *
+ * @param organizationId The ID of the organization whose organization discovery attributes are to be deleted.
+ * @return Organization discovery attribute deletion response.
+ */
+ public Response deleteOrganizationDiscoveryAttributes(String organizationId) {
+
+ try {
+ getOrganizationDiscoveryManager().deleteOrganizationDiscoveryAttributes(organizationId, true);
+ return Response.noContent().build();
+ } catch (OrganizationManagementClientException e) {
+ return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG);
+ } catch (OrganizationManagementException e) {
+ return OrganizationManagementEndpointUtil.handleServerErrorResponse(e, LOG);
+ }
+ }
+
+ /**
+ * Returns the discovery attributes of the organizations.
+ *
+ * @param filter The filter string. **Not supported at the moment.**
+ * @param offset The offset to be used with the limit parameter. **Not supported at the moment.**
+ * @param limit The items per page. **Not supported at the moment.**
+ * @return The discovery attributes of the organizations in the hierarchy under the root organization.
+ */
+ public Response getOrganizationsDiscoveryAttributes(String filter, Integer offset, Integer limit) {
+
+ handleNotImplementedCapabilities(filter, offset, limit);
+ try {
+ Map> organizationsDiscoveryAttributes =
+ getOrganizationDiscoveryManager().getOrganizationsDiscoveryAttributes();
+ OrganizationsDiscoveryResponse response = new OrganizationsDiscoveryResponse();
+ organizationsDiscoveryAttributes.forEach((key, value) -> {
+ OrganizationDiscoveryResponse organizationDiscoveryResponse = new OrganizationDiscoveryResponse();
+ organizationDiscoveryResponse.setOrganizationId(key);
+ value.forEach(orgDiscoveryAttribute -> {
+ DiscoveryAttribute organizationDiscoveryAttributeResponse = new DiscoveryAttribute();
+ organizationDiscoveryAttributeResponse.setType(orgDiscoveryAttribute.getType());
+ organizationDiscoveryAttributeResponse.setValues(orgDiscoveryAttribute.getValues());
+ organizationDiscoveryResponse.addAttributesItem(organizationDiscoveryAttributeResponse);
+
+ });
+ response.addOrganizationsItem(organizationDiscoveryResponse);
+ });
+ return Response.ok(response).build();
+ } catch (OrganizationManagementClientException e) {
+ return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG);
+ } catch (OrganizationManagementException e) {
+ return OrganizationManagementEndpointUtil.handleServerErrorResponse(e, LOG);
+ }
+ }
+
+ /**
+ * Check if the given organization discovery attribute is already taken by another organization in the hierarchy.
+ *
+ * @param organizationDiscoveryCheckPOSTRequest Organization discovery attribute check request.
+ * @return Organization discovery attribute check response.
+ */
+ public Response isDiscoveryAttributeAvailable(OrganizationDiscoveryCheckPOSTRequest
+ organizationDiscoveryCheckPOSTRequest) {
+
+ try {
+ boolean discoveryAttributeValueAvailable = getOrganizationDiscoveryManager()
+ .isDiscoveryAttributeValueAvailable(organizationDiscoveryCheckPOSTRequest.getType(),
+ organizationDiscoveryCheckPOSTRequest.getValue());
+ OrganizationDiscoveryCheckPOSTResponse organizationDiscoveryCheckPOSTResponse =
+ new OrganizationDiscoveryCheckPOSTResponse();
+ organizationDiscoveryCheckPOSTResponse.setAvailable(discoveryAttributeValueAvailable);
+ return Response.ok().entity(organizationDiscoveryCheckPOSTResponse).build();
+ } catch (OrganizationManagementClientException e) {
+ return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG);
+ } catch (OrganizationManagementException e) {
+ return OrganizationManagementEndpointUtil.handleServerErrorResponse(e, LOG);
+ }
+ }
+
+ /**
+ * Fetch organization metadata.
+ *
+ * @return Requested organization metadata.
+ */
+ public Response getOrganizationMetadata() {
+
+ try {
+ Organization organization = getOrganizationManager().getOrganization(getOrganizationId(), false, true);
+ List organizationDiscoveryAttributes = getOrganizationDiscoveryManager()
+ .getOrganizationDiscoveryAttributes(getOrganizationId(), false);
+ return Response.ok().entity(getOrganizationMetadataResponse(organization, organizationDiscoveryAttributes))
+ .build();
+ } catch (OrganizationManagementClientException e) {
+ return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG);
+ } catch (OrganizationManagementException e) {
+ return OrganizationManagementEndpointUtil.handleServerErrorResponse(e, LOG);
+ }
+ }
+
private Organization getOrganizationFromPostRequest(OrganizationPOSTRequest organizationPOSTRequest) {
String organizationId = generateUniqueID();
@@ -653,6 +830,113 @@ private SharedApplicationsResponse createSharedApplicationsResponse(List orgDiscoveryAttributeList) {
+
+ OrganizationDiscoveryAttributes discoveryAttributes = new OrganizationDiscoveryAttributes();
+ List attributes = orgDiscoveryAttributeList.stream()
+ .map(discoveryAttribute -> {
+ DiscoveryAttribute attribute = new DiscoveryAttribute();
+ attribute.setType(discoveryAttribute.getType());
+ attribute.setValues(discoveryAttribute.getValues());
+ return attribute;
+ }).collect(Collectors.toList());
+ discoveryAttributes.setAttributes(attributes);
+ return discoveryAttributes;
+ }
+
+ private List getOrgDiscoveryAttributesFromPostRequest(OrganizationDiscoveryPostRequest
+ discoveryPostRequest) {
+
+ return Optional.ofNullable(discoveryPostRequest.getAttributes()).orElse(Collections.emptyList())
+ .stream()
+ .map(attribute -> {
+ OrgDiscoveryAttribute orgDiscoveryAttribute = new OrgDiscoveryAttribute();
+ orgDiscoveryAttribute.setType(attribute.getType());
+ orgDiscoveryAttribute.setValues(attribute.getValues());
+ return orgDiscoveryAttribute;
+ }).collect(Collectors.toList());
+ }
+
+ private List getOrgDiscoveryAttributesFromPutRequest(OrganizationDiscoveryAttributes
+ discoveryAttributes) {
+
+ return Optional.ofNullable(discoveryAttributes.getAttributes()).orElse(Collections.emptyList())
+ .stream()
+ .map(attribute -> {
+ OrgDiscoveryAttribute orgDiscoveryAttribute = new OrgDiscoveryAttribute();
+ orgDiscoveryAttribute.setType(attribute.getType());
+ orgDiscoveryAttribute.setValues(attribute.getValues());
+ return orgDiscoveryAttribute;
+ }).collect(Collectors.toList());
+ }
+
+ private void handleNotImplementedCapabilities(String filter, Integer offset, Integer limit) {
+
+ if (limit != null || offset != null) {
+ Error error = OrganizationManagementEndpointUtil.getError(
+ ERROR_CODE_PAGINATION_NOT_IMPLEMENTED.getCode(),
+ ERROR_CODE_PAGINATION_NOT_IMPLEMENTED.getMessage(),
+ ERROR_CODE_PAGINATION_NOT_IMPLEMENTED.getDescription());
+ throw new OrganizationManagementEndpointException(Response.Status.NOT_IMPLEMENTED, error);
+ }
+ if (filter != null) {
+ Error error = OrganizationManagementEndpointUtil.getError(
+ ERROR_CODE_FILTERING_NOT_IMPLEMENTED.getCode(),
+ ERROR_CODE_FILTERING_NOT_IMPLEMENTED.getMessage(),
+ ERROR_CODE_FILTERING_NOT_IMPLEMENTED.getDescription());
+ throw new OrganizationManagementEndpointException(Response.Status.NOT_IMPLEMENTED, error);
+ }
+ }
+
+ private OrganizationMetadata getOrganizationMetadataResponse(Organization organization, List
+ organizationDiscoveryAttributes) {
+
+ OrganizationMetadata organizationMetadata = new OrganizationMetadata();
+ organizationMetadata.setId(organization.getId());
+ organizationMetadata.setName(organization.getName());
+ organizationMetadata.setDescription(organization.getDescription());
+ organizationMetadata.setCreated(organization.getCreated().toString());
+ organizationMetadata.setLastModified(organization.getLastModified().toString());
+ organizationMetadata.setPermissions(organization.getPermissions());
+
+ OrganizationMetadata.StatusEnum status;
+ try {
+ status = OrganizationMetadata.StatusEnum.valueOf(organization.getStatus());
+ } catch (IllegalArgumentException e) {
+ status = OrganizationMetadata.StatusEnum.DISABLED;
+ }
+ organizationMetadata.setStatus(status);
+
+ String type = organization.getType();
+ if (StringUtils.equals(type, GetOrganizationResponse.TypeEnum.TENANT.toString())) {
+ organizationMetadata.setType(OrganizationMetadata.TypeEnum.TENANT);
+ } else {
+ organizationMetadata.setType(OrganizationMetadata.TypeEnum.STRUCTURAL);
+ }
+
+ ParentOrganizationDO parentOrganizationDO = organization.getParent();
+ if (parentOrganizationDO != null) {
+ organizationMetadata.setParent(getParentOrganization(parentOrganizationDO));
+ }
+
+ List attributeList = getOrganizationAttributes(organization);
+ if (!attributeList.isEmpty()) {
+ organizationMetadata.setAttributes(attributeList);
+ }
+
+ List attributes = organizationDiscoveryAttributes.stream()
+ .map(discoveryAttribute -> {
+ DiscoveryAttribute attribute = new DiscoveryAttribute();
+ attribute.setType(discoveryAttribute.getType());
+ attribute.setValues(discoveryAttribute.getValues());
+ return attribute;
+ }).collect(Collectors.toList());
+ organizationMetadata.setDiscoveryAttributes(attributes);
+
+ return organizationMetadata;
+ }
+
private OrganizationManager getOrganizationManager() {
return OrganizationManagementServiceHolder.getInstance().getOrganizationManager();
@@ -662,4 +946,9 @@ private OrgApplicationManager getOrgApplicationManager() {
return OrganizationManagementServiceHolder.getInstance().getOrgApplicationManager();
}
+
+ private OrganizationDiscoveryManager getOrganizationDiscoveryManager() {
+
+ return OrganizationManagementServiceHolder.getInstance().getOrganizationDiscoveryManager();
+ }
}
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/util/OrganizationManagementEndpointUtil.java b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/util/OrganizationManagementEndpointUtil.java
index 0a5af975c4..623225e1d1 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/util/OrganizationManagementEndpointUtil.java
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/management/v1/util/OrganizationManagementEndpointUtil.java
@@ -31,6 +31,7 @@
import javax.ws.rs.core.Response;
+import static org.wso2.carbon.identity.api.server.organization.management.v1.constants.OrganizationManagementEndpointConstants.DISCOVERY_PATH;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_ERROR_BUILDING_PAGINATED_RESPONSE_URL;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_ERROR_BUILDING_RESPONSE_HEADER_URL;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_APPLICATION;
@@ -149,6 +150,18 @@ public static URI getResourceLocation(String organizationId) {
+ organizationId);
}
+ /**
+ * Get location of the created organization discovery attributes.
+ *
+ * @param organizationId The unique identifier of the organization.
+ * @return URI
+ */
+ public static URI getDiscoveryResourceLocation(String organizationId) {
+
+ return buildURIForHeader(V1_API_PATH_COMPONENT + PATH_SEPARATOR + ORGANIZATION_PATH + PATH_SEPARATOR
+ + organizationId + PATH_SEPARATOR + DISCOVERY_PATH);
+ }
+
private static URI buildURIForHeader(String endpoint) {
String context = getContext(endpoint);
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/META-INF/cxf/org-mgt-server-v1-cxf.xml b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/META-INF/cxf/org-mgt-server-v1-cxf.xml
index 767c7438c7..f2dd110f24 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/META-INF/cxf/org-mgt-server-v1-cxf.xml
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/META-INF/cxf/org-mgt-server-v1-cxf.xml
@@ -27,9 +27,12 @@
class="org.wso2.carbon.identity.api.server.organization.management.common.factory.OrganizationManagementOSGIServiceFactory"/>
+
+
diff --git a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/org.wso2.carbon.identity.organization.management.yaml b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/org.wso2.carbon.identity.organization.management.yaml
index 427f54abbe..003cd79bc2 100644
--- a/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/org.wso2.carbon.identity.organization.management.yaml
+++ b/components/org.wso2.carbon.identity.api.server.organization.management/org.wso2.carbon.identity.api.server.organization.management.v1/src/main/resources/org.wso2.carbon.identity.organization.management.yaml
@@ -522,6 +522,251 @@ paths:
tags:
- Organization Application Management
+ /organizations/discovery:
+ post:
+ tags:
+ - Organization Discovery
+ description:
+ This API serves the purpose of adding discovery attributes to an organization, with the current restriction that only the primary organization has the capability to perform this action.
+ Permission required:
+ * /permission/admin/manage/identity/organizationmgt/update
+ Scope required:
+ * internal_organization_update
+ summary:
+ Map discovery attributes to the organization.
+ operationId: organizationDiscoveryPost
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationDiscoveryPostRequest'
+ description: This represents the organization discovery attributes to be added.
+ required: true
+ responses:
+ '201':
+ description: Successful response
+ headers:
+ Location:
+ description: Location URL to fetch the discovery attributes of the organization.
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationDiscoveryAttributes'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ get:
+ tags:
+ - Organization Discovery
+ description:
+ This API facilitates the retrieval of discovery attributes of organizations in the hierarchy, allowing filtering by discovery attribute type and value. It currently provides the capability to retrieve these attributes from only the primary organization.
+ Permission required:
+ * /permission/admin/manage/identity/organizationmgt/view
+ Scope required:
+ * internal_organization_view
+ summary:
+ Get discovery attributes of organizations.
+ operationId: organizationsDiscoveryGet
+ parameters:
+ - $ref: '#/components/parameters/filterQueryParam'
+ - $ref: '#/components/parameters/offsetQueryParam'
+ - $ref: '#/components/parameters/limitQueryParam'
+ responses:
+ '200':
+ description: Successful response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationsDiscoveryResponse'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ '501':
+ $ref: '#/components/responses/NotImplemented'
+ /organizations/{organization-id}/discovery:
+ get:
+ tags:
+ - Organization Discovery
+ description:
+ This API facilitates the retrieval of discovery attributes for an organization. It currently provides the capability to retrieve these attributes only from the primary organization.
+ Permission required:
+ * /permission/admin/manage/identity/organizationmgt/view
+ Scope required:
+ * internal_organization_view
+ summary:
+ Get discovery attributes of the organization.
+ operationId: organizationDiscoveryGet
+ parameters:
+ - name: organization-id
+ in: path
+ description: ID of the organization whose discovery attributes are to be fetched.
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Successful response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationDiscoveryAttributes'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/NotFound'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ '501':
+ $ref: '#/components/responses/NotImplemented'
+ delete:
+ tags:
+ - Organization Discovery
+ description:
+ This API serves the purpose of deleting discovery attributes of an organization, with the current restriction that only the primary organization has the capability to perform this action.
+ Permission required:
+ * /permission/admin/manage/identity/organizationmgt/update
+ Scope required:
+ * internal_organization_update
+ summary:
+ Delete discovery attributes of an organization.
+ parameters:
+ - name: organization-id
+ in: path
+ description: ID of the organization whose discovery attributes are to be deleted.
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: Successfully deleted
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/NotFound'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ put:
+ tags:
+ - Organization Discovery
+ description:
+ This API serves the purpose of updating discovery attributes of an organization, with the current restriction that only the primary organization has the capability to perform this action.
+ Permission required:
+ * /permission/admin/manage/identity/organizationmgt/update
+ Scope required:
+ * internal_organization_update
+ summary:
+ Update discovery attributes of an organization.
+ parameters:
+ - name: organization-id
+ in: path
+ description: ID of the organization whose discovery attributes are to be updated.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationDiscoveryAttributes'
+ required: true
+ responses:
+ '200':
+ description: Successful response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationDiscoveryAttributes'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/NotFound'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ /organizations/check-discovery:
+ post:
+ tags:
+ - Organization Discovery
+ summary: Check whether given discovery attribute exists among the organization hierarchy.
+ description: This API is used to verify whether a specific discovery attribute has already been associated with an organization within the hierarchy. It is available for use within any organization in the hierarchy.
+ Permission required:
+ * /permission/admin/manage/identity/organizationmgt/view
+ Scope required:
+ * internal_organization_view
+ operationId: organizationCheckDiscovery
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationDiscoveryCheckPOSTRequest'
+ required: true
+ responses:
+ '200':
+ description: Successful response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationDiscoveryCheckPOSTResponse'
+ '404':
+ $ref: '#/components/responses/NotFound'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ /organizations/metadata:
+ get:
+ tags:
+ - Organization Metadata
+ description:
+ This API facilitates the retrieval of metadata including discovery attributes of the logged in organization.
+ Permission required:
+ * /permission/admin/manage/identity/organizationmgt/view
+ Scope required:
+ * internal_organization_view
+ summary:
+ Get metadata of the logged in organization.
+ operationId: organizationMetadataGet
+ responses:
+ '200':
+ description: Successful response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OrganizationMetadata'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '500':
+ $ref: '#/components/responses/ServerError'
+
components:
parameters:
filterQueryParam:
@@ -542,6 +787,15 @@ components:
type: integer
format: int32
minimum: 0
+ offsetQueryParam:
+ in: query
+ name: offset
+ required: false
+ description: Number of records to skip for pagination.
+ schema:
+ type: integer
+ format: int32
+ minimum: 0
beforeQueryParam:
in: query
name: before
@@ -906,6 +1160,159 @@ components:
type: string
description: Shared application residing organization id.
example: '682edf68-4835-4bb8-961f-0a16bc6cc866'
+
+ OrganizationDiscoveryPostRequest:
+ type: object
+ required:
+ - organizationId
+ - attributes
+ properties:
+ organizationId:
+ type: string
+ description: The ID of the organization whose discovery attributes are to be added.
+ example: '06c1f4e2-3339-44e4-a825-96585e3653b1'
+ attributes:
+ type: array
+ items:
+ $ref: '#/components/schemas/DiscoveryAttribute'
+ OrganizationDiscoveryAttributes:
+ type: object
+ required:
+ - attributes
+ properties:
+ attributes:
+ type: array
+ items:
+ $ref: '#/components/schemas/DiscoveryAttribute'
+ DiscoveryAttribute:
+ type: object
+ required:
+ - type
+ - value
+ properties:
+ type:
+ type: string
+ example: 'emailDomain'
+ values:
+ type: array
+ items:
+ type: string
+ example: 'abc.com'
+ OrganizationsDiscoveryResponse:
+ type: object
+ properties:
+ totalResults:
+ type: integer
+ example: 10
+ startIndex:
+ type: integer
+ example: 1
+ count:
+ type: integer
+ example: 10
+ links:
+ type: array
+ items:
+ $ref: '#/components/schemas/Link'
+ example:
+ [
+ {
+ "href": "/o/10084a8d-113f-4211-a0d5-efe36b082211/api/server/v1/organizations/discovery?filter=attributes.type+eq+emailDomain&limit=10&offset=50",
+ "rel": "next",
+ }, {
+ "href": "/o/10084a8d-113f-4211-a0d5-efe36b082211/api/server/v1/organizations/discovery?filter=attributes.type+eq+emailDomain&limit=10&offset=30",
+ "rel": "previous",
+ }
+ ]
+ organizations:
+ type: array
+ items:
+ $ref: '#/components/schemas/OrganizationDiscoveryResponse'
+ OrganizationDiscoveryResponse:
+ type: object
+ required:
+ - organizationId
+ - attributes
+ properties:
+ organizationId:
+ type: string
+ description: The ID of the organization.
+ example: '06c1f4e2-3339-44e4-a825-96585e3653b1'
+ attributes:
+ type: array
+ items:
+ $ref: '#/components/schemas/DiscoveryAttribute'
+ OrganizationDiscoveryCheckPOSTRequest:
+ required:
+ - type
+ - value
+ type: object
+ properties:
+ type:
+ type: string
+ example: 'emailDomain'
+ value:
+ type: string
+ example: 'abc.com'
+ OrganizationDiscoveryCheckPOSTResponse:
+ type: object
+ required:
+ - available
+ properties:
+ available:
+ type: boolean
+ example: true
+
+ OrganizationMetadata:
+ type: object
+ required:
+ - id
+ - name
+ - status
+ - created
+ - lastModified
+ - type
+ properties:
+ id:
+ type: string
+ example: '06c1f4e2-3339-44e4-a825-96585e3653b1'
+ name:
+ type: string
+ example: 'ABC Builders'
+ description:
+ type: string
+ example: 'Building constructions'
+ status:
+ type: string
+ enum: [ACTIVE, DISABLED]
+ example: ACTIVE
+ created:
+ type: string
+ example: '2021-10-25T12:31:53.406Z'
+ lastModified:
+ type: string
+ example: '2021-10-25T12:31:53.406Z'
+ type:
+ type: string
+ example: "TENANT"
+ enum:
+ - TENANT
+ - STRUCTURAL
+ parent:
+ $ref: '#/components/schemas/ParentOrganization'
+ attributes:
+ type: array
+ items:
+ $ref: '#/components/schemas/Attribute'
+ permissions:
+ type: array
+ items:
+ type: string
+ discoveryAttributes:
+ type: array
+ items:
+ $ref: '#/components/schemas/DiscoveryAttribute'
+
#--------------------------------------------------------
# Descriptions of Organization Management API responses.
#--------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 18bbfeb1c1..26d00b4696 100644
--- a/pom.xml
+++ b/pom.xml
@@ -561,6 +561,12 @@
${org.wso2.carbon.identity.organization.management.version}
provided
+
+ org.wso2.carbon.identity.organization.management
+ org.wso2.carbon.identity.organization.discovery.service
+ ${org.wso2.carbon.identity.organization.management.version}
+ provided
+
org.wso2.carbon.identity.server.api
org.wso2.carbon.identity.api.server.organization.management.common
@@ -753,13 +759,13 @@
1.0.3
- 1.0.56
+ 1.0.64
[1.0.0, 2.0.0)
- 1.3.70
+ 1.3.73