diff --git a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/dto/ExternalClaimResDTO.java b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/dto/ExternalClaimResDTO.java index 8c4cd0d886..c9436ef1b5 100644 --- a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/dto/ExternalClaimResDTO.java +++ b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/dto/ExternalClaimResDTO.java @@ -23,6 +23,8 @@ import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; +import java.util.ArrayList; +import java.util.List; /** * External claim response. @@ -42,6 +44,9 @@ public class ExternalClaimResDTO extends ClaimResDTO { @Valid private String mappedLocalClaimURI = null; + @Valid + private List properties = new ArrayList(); + /** * External claim ID. **/ @@ -90,6 +95,18 @@ public void setMappedLocalClaimURI(String mappedLocalClaimURI) { this.mappedLocalClaimURI = mappedLocalClaimURI; } + /** + * Define any additional properties if required. + **/ + @ApiModelProperty(value = "Define any additional properties if required.") + @JsonProperty("properties") + public List getProperties() { + return properties; + } + public void setProperties(List properties) { + this.properties = properties; + } + @Override public String toString() { @@ -101,6 +118,7 @@ public String toString() { sb.append(" claimURI: ").append(claimURI).append("\n"); sb.append(" claimDialectURI: ").append(claimDialectURI).append("\n"); sb.append(" mappedLocalClaimURI: ").append(mappedLocalClaimURI).append("\n"); + sb.append(" properties: ").append(properties).append("\n"); sb.append("}\n"); return sb.toString(); diff --git a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/core/ServerClaimManagementService.java b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/core/ServerClaimManagementService.java index 4146a2dcdb..1afbe00801 100644 --- a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/core/ServerClaimManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/core/ServerClaimManagementService.java @@ -159,6 +159,12 @@ public class ServerClaimManagementService { ClaimConstants.ErrorMessage.ERROR_CODE_EXISTING_LOCAL_CLAIM_URI.getCode() ); + private static final List forbiddenErrorScenarios = Arrays.asList( + ClaimConstants.ErrorMessage.ERROR_CODE_NO_RENAME_SYSTEM_DIALECT.getCode(), + ClaimConstants.ErrorMessage.ERROR_CODE_NO_DELETE_SYSTEM_DIALECT.getCode(), + ClaimConstants.ErrorMessage.ERROR_CODE_NO_DELETE_SYSTEM_CLAIM.getCode() + ); + /** * Add a claim dialect. * @@ -944,6 +950,7 @@ private ExternalClaimResDTO getExternalClaimResDTO(ExternalClaim externalClaim) externalClaimResDTO.setClaimDialectURI(externalClaim.getClaimDialectURI()); externalClaimResDTO.setClaimURI(externalClaim.getClaimURI()); externalClaimResDTO.setMappedLocalClaimURI(externalClaim.getMappedLocalClaim()); + externalClaimResDTO.setProperties(mapToProperties(externalClaim.getClaimProperties())); return externalClaimResDTO; } @@ -1265,6 +1272,9 @@ private APIError handleClaimManagementException(ClaimMetadataException e, Consta if (isConflictScenario(e.getErrorCode())) { status = CONFLICT; } + if (isForbiddenScenario(e.getErrorCode())) { + status = FORBIDDEN; + } if (StringUtils.isNotBlank(e.getErrorCode()) && e.getErrorCode().contains(Constant.CLAIM_MANAGEMENT_PREFIX)) { return handleClaimManagementClientError(e.getErrorCode(), e.getMessage(), status, data); @@ -1287,6 +1297,11 @@ private boolean isConflictScenario(String errorCode) { return !StringUtils.isBlank(errorCode) && conflictErrorScenarios.contains(errorCode); } + private boolean isForbiddenScenario(String errorCode) { + + return !StringUtils.isBlank(errorCode) && forbiddenErrorScenarios.contains(errorCode); + } + private APIError handleClaimManagementClientError(Constant.ErrorMessage errorEnum, Response.Status status) { return handleClaimManagementClientError(errorEnum, status, StringUtils.EMPTY); diff --git a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/resources/claim-management.yaml b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/resources/claim-management.yaml index c788734b40..6231037ef2 100644 --- a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/resources/claim-management.yaml +++ b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/resources/claim-management.yaml @@ -910,6 +910,11 @@ definitions: type: string description: The local claim URI to map with the external claim. example: "http://wso2.org/claims/username" + properties: + type: array + description: Define any additional properties if required. + items: + $ref: '#/definitions/Property' #----------------------------------------------------- # Property Object diff --git a/pom.xml b/pom.xml index 8f35524226..e345f22571 100644 --- a/pom.xml +++ b/pom.xml @@ -809,7 +809,7 @@ 1.4 1.2.4 1.11.11 - 7.5.117 + 7.6.4 3.0.5 1.12.0 **/gen/**/*