diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.common/src/main/java/org/wso2/carbon/identity/api/server/application/management/common/ApplicationManagementConstants.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.common/src/main/java/org/wso2/carbon/identity/api/server/application/management/common/ApplicationManagementConstants.java index a6e06d6887..7621ba3339 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.common/src/main/java/org/wso2/carbon/identity/api/server/application/management/common/ApplicationManagementConstants.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.common/src/main/java/org/wso2/carbon/identity/api/server/application/management/common/ApplicationManagementConstants.java @@ -54,6 +54,7 @@ private ApplicationManagementConstants() { public static final String DEFAULT_CERTIFICATE_ALIAS = "wso2carbon"; public static final String ADVANCED_CONFIGURATIONS = "advancedConfigurations"; public static final String APPLICATION_ENABLED = "applicationEnabled"; + public static final String ORGANIZATION_CUSTOM_ROLES_ENABLED = "organizationCustomRolesEnabled"; public static final String TEMPLATE_ID = "templateId"; public static final String TEMPLATE_VERSION = "templateVersion"; public static final String NAME = "name"; @@ -203,6 +204,14 @@ public enum ErrorMessage { UNSUPPORTED_ENHANCED_ORGANIZATION_AUTHENTICATION_ENABLED_CONFIGURATION("60521", "Enhanced organization authentication enabled property is not supported.", "The 'enhancedOrgAuthenticationEnabled' property is not yet supported."), + UNSUPPORTED_ORGANIZATION_CUSTOM_ROLES_CONFIGURATION("60522", + "Organization custom roles property is not supported.", + "The 'organizationCustomRolesEnabled' property requires enhanced organization authentication " + + "to be supported."), + ORGANIZATION_CUSTOM_ROLES_FEATURE_DISABLED("60523", + "Organization custom roles property is not supported.", + "The 'organizationCustomRolesEnabled' property cannot be enabled as the organization custom roles " + + "feature is disabled in the server."), // Server Errors. ERROR_RETRIEVING_SAML_METADATA("65001", diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationListItem.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationListItem.java index b0e08722e0..d27671782f 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationListItem.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationListItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com). + * Copyright (c) 2023-2026, WSO2 LLC. (http://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -83,6 +83,7 @@ public static AccessEnum fromValue(String value) { private String templateVersion; private AssociatedRolesConfig associatedRoles; private Boolean enhancedOrgAuthenticationEnabled; + private Boolean organizationCustomRolesEnabled; private Boolean applicationEnabled; /** @@ -374,6 +375,24 @@ public void setEnhancedOrgAuthenticationEnabled(Boolean enhancedOrgAuthenticatio this.enhancedOrgAuthenticationEnabled = enhancedOrgAuthenticationEnabled; } + /** + **/ + public ApplicationListItem organizationCustomRolesEnabled(Boolean organizationCustomRolesEnabled) { + + this.organizationCustomRolesEnabled = organizationCustomRolesEnabled; + return this; + } + + @ApiModelProperty(example = "false", value = "") + @JsonProperty("organizationCustomRolesEnabled") + @Valid + public Boolean getOrganizationCustomRolesEnabled() { + return organizationCustomRolesEnabled; + } + public void setOrganizationCustomRolesEnabled(Boolean organizationCustomRolesEnabled) { + this.organizationCustomRolesEnabled = organizationCustomRolesEnabled; + } + /** **/ public ApplicationListItem applicationEnabled(Boolean applicationEnabled) { @@ -420,12 +439,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.templateVersion, applicationListItem.templateVersion) && Objects.equals(this.associatedRoles, applicationListItem.associatedRoles) && Objects.equals(this.enhancedOrgAuthenticationEnabled, applicationListItem.enhancedOrgAuthenticationEnabled) && + Objects.equals(this.organizationCustomRolesEnabled, applicationListItem.organizationCustomRolesEnabled) && Objects.equals(this.applicationEnabled, applicationListItem.applicationEnabled); } @Override public int hashCode() { - return Objects.hash(id, name, description, applicationVersion, image, accessUrl, clientId, issuer, realm, access, self, advancedConfigurations, templateId, templateVersion, associatedRoles, enhancedOrgAuthenticationEnabled, applicationEnabled); + return Objects.hash(id, name, description, applicationVersion, image, accessUrl, clientId, issuer, realm, access, self, advancedConfigurations, templateId, templateVersion, associatedRoles, enhancedOrgAuthenticationEnabled, organizationCustomRolesEnabled, applicationEnabled); } @Override @@ -450,6 +470,7 @@ public String toString() { sb.append(" templateVersion: ").append(toIndentedString(templateVersion)).append("\n"); sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n"); sb.append(" enhancedOrgAuthenticationEnabled: ").append(toIndentedString(enhancedOrgAuthenticationEnabled)).append("\n"); + sb.append(" organizationCustomRolesEnabled: ").append(toIndentedString(organizationCustomRolesEnabled)).append("\n"); sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationModel.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationModel.java index d6da000f45..049b4acddb 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationModel.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationModel.java @@ -49,6 +49,7 @@ public class ApplicationModel { private Boolean isManagementApp = false; private Boolean isB2BSelfServiceApp = false; private Boolean enhancedOrgAuthenticationEnabled; + private Boolean organizationCustomRolesEnabled; private Boolean applicationEnabled = true; private AssociatedRolesConfig associatedRoles; private ClaimConfiguration claimConfiguration; @@ -261,6 +262,25 @@ public void setEnhancedOrgAuthenticationEnabled(Boolean enhancedOrgAuthenticatio this.enhancedOrgAuthenticationEnabled = enhancedOrgAuthenticationEnabled; } + /** + * For a main application, decides whether organizations can create custom roles for its shared applications. + **/ + public ApplicationModel organizationCustomRolesEnabled(Boolean organizationCustomRolesEnabled) { + + this.organizationCustomRolesEnabled = organizationCustomRolesEnabled; + return this; + } + + @ApiModelProperty(example = "false", value = "For a main application, decides whether organizations can create custom roles for its shared applications.") + @JsonProperty("organizationCustomRolesEnabled") + @Valid + public Boolean getOrganizationCustomRolesEnabled() { + return organizationCustomRolesEnabled; + } + public void setOrganizationCustomRolesEnabled(Boolean organizationCustomRolesEnabled) { + this.organizationCustomRolesEnabled = organizationCustomRolesEnabled; + } + /** * Decides whether the application is enabled. **/ @@ -411,6 +431,7 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.isManagementApp, applicationModel.isManagementApp) && Objects.equals(this.isB2BSelfServiceApp, applicationModel.isB2BSelfServiceApp) && Objects.equals(this.enhancedOrgAuthenticationEnabled, applicationModel.enhancedOrgAuthenticationEnabled) && + Objects.equals(this.organizationCustomRolesEnabled, applicationModel.organizationCustomRolesEnabled) && Objects.equals(this.applicationEnabled, applicationModel.applicationEnabled) && Objects.equals(this.associatedRoles, applicationModel.associatedRoles) && Objects.equals(this.claimConfiguration, applicationModel.claimConfiguration) && @@ -422,7 +443,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, templateVersion, isManagementApp, isB2BSelfServiceApp, enhancedOrgAuthenticationEnabled, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocolConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations); + return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, templateVersion, isManagementApp, isB2BSelfServiceApp, enhancedOrgAuthenticationEnabled, organizationCustomRolesEnabled, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocolConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations); } @Override @@ -442,6 +463,7 @@ public String toString() { sb.append(" isManagementApp: ").append(toIndentedString(isManagementApp)).append("\n"); sb.append(" isB2BSelfServiceApp: ").append(toIndentedString(isB2BSelfServiceApp)).append("\n"); sb.append(" enhancedOrgAuthenticationEnabled: ").append(toIndentedString(enhancedOrgAuthenticationEnabled)).append("\n"); + sb.append(" organizationCustomRolesEnabled: ").append(toIndentedString(organizationCustomRolesEnabled)).append("\n"); sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n"); sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n"); sb.append(" claimConfiguration: ").append(toIndentedString(claimConfiguration)).append("\n"); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationPatchModel.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationPatchModel.java index 1fef5dd933..59390068f8 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationPatchModel.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationPatchModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com). + * Copyright (c) 2023-2026, WSO2 LLC. (http://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -46,6 +46,7 @@ public class ApplicationPatchModel { private String templateId; private String templateVersion; private Boolean enhancedOrgAuthenticationEnabled; + private Boolean organizationCustomRolesEnabled; private Boolean applicationEnabled; private AssociatedRolesConfig associatedRoles; private ClaimConfiguration claimConfiguration; @@ -217,6 +218,25 @@ public void setEnhancedOrgAuthenticationEnabled(Boolean enhancedOrgAuthenticatio this.enhancedOrgAuthenticationEnabled = enhancedOrgAuthenticationEnabled; } + /** + * For a main application, decides whether organizations can create custom roles for its shared applications. + **/ + public ApplicationPatchModel organizationCustomRolesEnabled(Boolean organizationCustomRolesEnabled) { + + this.organizationCustomRolesEnabled = organizationCustomRolesEnabled; + return this; + } + + @ApiModelProperty(example = "false", value = "For a main application, decides whether organizations can create custom roles for its shared applications.") + @JsonProperty("organizationCustomRolesEnabled") + @Valid + public Boolean getOrganizationCustomRolesEnabled() { + return organizationCustomRolesEnabled; + } + public void setOrganizationCustomRolesEnabled(Boolean organizationCustomRolesEnabled) { + this.organizationCustomRolesEnabled = organizationCustomRolesEnabled; + } + /** * Decides whether the application is enabled. **/ @@ -340,12 +360,14 @@ public boolean equals(java.lang.Object o) { ApplicationPatchModel applicationPatchModel = (ApplicationPatchModel) o; return Objects.equals(this.name, applicationPatchModel.name) && Objects.equals(this.description, applicationPatchModel.description) && + Objects.equals(this.applicationVersion, applicationPatchModel.applicationVersion) && Objects.equals(this.imageUrl, applicationPatchModel.imageUrl) && Objects.equals(this.accessUrl, applicationPatchModel.accessUrl) && Objects.equals(this.logoutReturnUrl, applicationPatchModel.logoutReturnUrl) && Objects.equals(this.templateId, applicationPatchModel.templateId) && Objects.equals(this.templateVersion, applicationPatchModel.templateVersion) && Objects.equals(this.enhancedOrgAuthenticationEnabled, applicationPatchModel.enhancedOrgAuthenticationEnabled) && + Objects.equals(this.organizationCustomRolesEnabled, applicationPatchModel.organizationCustomRolesEnabled) && Objects.equals(this.applicationEnabled, applicationPatchModel.applicationEnabled) && Objects.equals(this.associatedRoles, applicationPatchModel.associatedRoles) && Objects.equals(this.claimConfiguration, applicationPatchModel.claimConfiguration) && @@ -356,7 +378,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, templateVersion, enhancedOrgAuthenticationEnabled, applicationEnabled, associatedRoles, claimConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations); + return Objects.hash(name, description, applicationVersion, imageUrl, accessUrl, logoutReturnUrl, templateId, templateVersion, enhancedOrgAuthenticationEnabled, organizationCustomRolesEnabled, applicationEnabled, associatedRoles, claimConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations); } @Override @@ -367,12 +389,14 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" applicationVersion: ").append(toIndentedString(applicationVersion)).append("\n"); sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); sb.append(" accessUrl: ").append(toIndentedString(accessUrl)).append("\n"); sb.append(" logoutReturnUrl: ").append(toIndentedString(logoutReturnUrl)).append("\n"); sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n"); sb.append(" templateVersion: ").append(toIndentedString(templateVersion)).append("\n"); sb.append(" enhancedOrgAuthenticationEnabled: ").append(toIndentedString(enhancedOrgAuthenticationEnabled)).append("\n"); + sb.append(" organizationCustomRolesEnabled: ").append(toIndentedString(organizationCustomRolesEnabled)).append("\n"); sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n"); sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n"); sb.append(" claimConfiguration: ").append(toIndentedString(claimConfiguration)).append("\n"); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationResponseModel.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationResponseModel.java index ab1c7548f3..843b5d3f38 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationResponseModel.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationResponseModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com). + * Copyright (c) 2023-2026, WSO2 LLC. (http://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -55,6 +55,7 @@ public class ApplicationResponseModel { private Boolean isManagementApp; private Boolean isB2BSelfServiceApp; private Boolean enhancedOrgAuthenticationEnabled; + private Boolean organizationCustomRolesEnabled; private Boolean applicationEnabled; private AssociatedRolesConfig associatedRoles; private ClaimConfiguration claimConfiguration; @@ -374,6 +375,25 @@ public void setEnhancedOrgAuthenticationEnabled(Boolean enhancedOrgAuthenticatio this.enhancedOrgAuthenticationEnabled = enhancedOrgAuthenticationEnabled; } + /** + * For a main application, decides whether organizations can create custom roles for its shared applications. + **/ + public ApplicationResponseModel organizationCustomRolesEnabled(Boolean organizationCustomRolesEnabled) { + + this.organizationCustomRolesEnabled = organizationCustomRolesEnabled; + return this; + } + + @ApiModelProperty(example = "false", value = "For a main application, decides whether organizations can create custom roles for its shared applications.") + @JsonProperty("organizationCustomRolesEnabled") + @Valid + public Boolean getOrganizationCustomRolesEnabled() { + return organizationCustomRolesEnabled; + } + public void setOrganizationCustomRolesEnabled(Boolean organizationCustomRolesEnabled) { + this.organizationCustomRolesEnabled = organizationCustomRolesEnabled; + } + /** * Decides whether the application is enabled. **/ @@ -554,6 +574,7 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.isManagementApp, applicationResponseModel.isManagementApp) && Objects.equals(this.isB2BSelfServiceApp, applicationResponseModel.isB2BSelfServiceApp) && Objects.equals(this.enhancedOrgAuthenticationEnabled, applicationResponseModel.enhancedOrgAuthenticationEnabled) && + Objects.equals(this.organizationCustomRolesEnabled, applicationResponseModel.organizationCustomRolesEnabled) && Objects.equals(this.applicationEnabled, applicationResponseModel.applicationEnabled) && Objects.equals(this.associatedRoles, applicationResponseModel.associatedRoles) && Objects.equals(this.claimConfiguration, applicationResponseModel.claimConfiguration) && @@ -566,7 +587,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(id, name, description, applicationVersion, imageUrl, accessUrl, logoutReturnUrl, clientId, issuer, realm, templateId, templateVersion, isManagementApp, isB2BSelfServiceApp, enhancedOrgAuthenticationEnabled, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocols, authenticationSequence, advancedConfigurations, provisioningConfigurations, access); + return Objects.hash(id, name, description, applicationVersion, imageUrl, accessUrl, logoutReturnUrl, clientId, issuer, realm, templateId, templateVersion, isManagementApp, isB2BSelfServiceApp, enhancedOrgAuthenticationEnabled, organizationCustomRolesEnabled, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocols, authenticationSequence, advancedConfigurations, provisioningConfigurations, access); } @Override @@ -590,6 +611,7 @@ public String toString() { sb.append(" isManagementApp: ").append(toIndentedString(isManagementApp)).append("\n"); sb.append(" isB2BSelfServiceApp: ").append(toIndentedString(isB2BSelfServiceApp)).append("\n"); sb.append(" enhancedOrgAuthenticationEnabled: ").append(toIndentedString(enhancedOrgAuthenticationEnabled)).append("\n"); + sb.append(" organizationCustomRolesEnabled: ").append(toIndentedString(organizationCustomRolesEnabled)).append("\n"); sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n"); sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n"); sb.append(" claimConfiguration: ").append(toIndentedString(claimConfiguration)).append("\n"); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java index a6309465a9..4a5c48ac6b 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java @@ -127,6 +127,7 @@ import org.wso2.carbon.identity.application.common.util.IdentityApplicationManagementUtil; import org.wso2.carbon.identity.application.mgt.ApplicationConstants; import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; +import org.wso2.carbon.identity.application.mgt.ApplicationMgtUtil; import org.wso2.carbon.identity.application.mgt.AuthorizedAPIManagementService; import org.wso2.carbon.identity.application.mgt.inbound.dto.ApplicationDTO; import org.wso2.carbon.identity.application.mgt.inbound.dto.InboundProtocolConfigurationDTO; @@ -201,11 +202,14 @@ import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.ERROR_PROCESSING_REQUEST; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.FORBIDDEN_OPERATION; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.INBOUND_NOT_CONFIGURED; +import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.ORGANIZATION_CUSTOM_ROLES_FEATURE_DISABLED; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.UNSUPPORTED_ENHANCED_ORGANIZATION_AUTHENTICATION_ENABLED_CONFIGURATION; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.UNSUPPORTED_FAPI_PROFILE; +import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.UNSUPPORTED_ORGANIZATION_CUSTOM_ROLES_CONFIGURATION; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.USE_EXTERNAL_CONSENT_PAGE_NOT_SUPPORTED; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ISSUER; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.NAME; +import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ORGANIZATION_CUSTOM_ROLES_ENABLED; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.TEMPLATE_ID; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.TEMPLATE_VERSION; import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.VIEW_APPLICATION_CLIENT_SECRET_OPERATION; @@ -290,6 +294,7 @@ public ServerApplicationManagementService(ApplicationManagementService applicati SUPPORTED_REQUIRED_ATTRIBUTES.add(ISSUER); SUPPORTED_REQUIRED_ATTRIBUTES.add(APPLICATION_ENABLED); SUPPORTED_REQUIRED_ATTRIBUTES.add(IdentityApplicationConstants.ALLOWED_ROLE_AUDIENCE_REQUEST_ATTRIBUTE_NAME); + SUPPORTED_REQUIRED_ATTRIBUTES.add(ORGANIZATION_CUSTOM_ROLES_ENABLED); } @Deprecated @@ -855,6 +860,18 @@ public String createApplication(ApplicationModel applicationModel, String templa UNSUPPORTED_ENHANCED_ORGANIZATION_AUTHENTICATION_ENABLED_CONFIGURATION.getDescription()); } + if (!isEnhancedOrganizationAuthenticationFeatureEnabled() && + Boolean.TRUE.equals(applicationModel.getOrganizationCustomRolesEnabled())) { + throw buildBadRequestError(UNSUPPORTED_ORGANIZATION_CUSTOM_ROLES_CONFIGURATION.getCode(), + UNSUPPORTED_ORGANIZATION_CUSTOM_ROLES_CONFIGURATION.getDescription()); + } + + if (!ApplicationMgtUtil.isOrganizationCustomRolesFeatureEnabled() && + Boolean.TRUE.equals(applicationModel.getOrganizationCustomRolesEnabled())) { + throw buildBadRequestError(ORGANIZATION_CUSTOM_ROLES_FEATURE_DISABLED.getCode(), + ORGANIZATION_CUSTOM_ROLES_FEATURE_DISABLED.getDescription()); + } + if (applicationModel.getEnhancedOrgAuthenticationEnabled() == null && isEnhancedOrganizationAuthenticationFeatureEnabled()) { applicationModel.setEnhancedOrgAuthenticationEnabled(isEnhancedOrgAuthEnabledByDefaultForNewApps()); @@ -928,6 +945,18 @@ public void patchApplication(String applicationId, ApplicationPatchModel applica UNSUPPORTED_ENHANCED_ORGANIZATION_AUTHENTICATION_ENABLED_CONFIGURATION.getDescription()); } + if (!isEnhancedOrganizationAuthenticationFeatureEnabled() && applicationPatchModel != null && + Boolean.TRUE.equals(applicationPatchModel.getOrganizationCustomRolesEnabled())) { + throw buildBadRequestError(UNSUPPORTED_ORGANIZATION_CUSTOM_ROLES_CONFIGURATION.getCode(), + UNSUPPORTED_ORGANIZATION_CUSTOM_ROLES_CONFIGURATION.getDescription()); + } + + if (!ApplicationMgtUtil.isOrganizationCustomRolesFeatureEnabled() && applicationPatchModel != null && + Boolean.TRUE.equals(applicationPatchModel.getOrganizationCustomRolesEnabled())) { + throw buildBadRequestError(ORGANIZATION_CUSTOM_ROLES_FEATURE_DISABLED.getCode(), + ORGANIZATION_CUSTOM_ROLES_FEATURE_DISABLED.getDescription()); + } + /* * Updating the adaptive script requires the internal_application_script_update scope. * Validate the permission before allowing the update. @@ -2042,6 +2071,9 @@ private List getApplicationListItems(List if (requiredAttributes.stream().noneMatch(attribute -> attribute.equals(APPLICATION_ENABLED))) { applicationResponseModel.applicationEnabled(null); } + if (!requiredAttributes.contains(ORGANIZATION_CUSTOM_ROLES_ENABLED)) { + applicationResponseModel.organizationCustomRolesEnabled(null); + } applicationListItems.add(new ApplicationInfoWithRequiredPropsToApiModel().apply(applicationResponseModel)); } return applicationListItems; diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ApiModelToServiceProvider.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ApiModelToServiceProvider.java index 076cf5a796..d6cd479e10 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ApiModelToServiceProvider.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ApiModelToServiceProvider.java @@ -55,6 +55,8 @@ public ApplicationDTO apply(ApplicationModel applicationModel) throws IdentityAp setIfNotNull(applicationModel.getApplicationEnabled(), application::setApplicationEnabled); setIfNotNull(applicationModel.getEnhancedOrgAuthenticationEnabled(), application::setEnhancedOrganizationAuthenticationEnabled); + setIfNotNull(applicationModel.getOrganizationCustomRolesEnabled(), + application::setOrganizationCustomRolesEnabled); addAdvancedConfigurationToApplication(application, applicationModel.getAdvancedConfigurations()); addClaimConfigurationToApplication(application, applicationModel.getClaimConfiguration()); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ApplicationInfoWithRequiredPropsToApiModel.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ApplicationInfoWithRequiredPropsToApiModel.java index e4202185b7..e67697917f 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ApplicationInfoWithRequiredPropsToApiModel.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ApplicationInfoWithRequiredPropsToApiModel.java @@ -61,6 +61,7 @@ public ApplicationListItem apply(ApplicationResponseModel applicationResponseMod .templateVersion(applicationResponseModel.getTemplateVersion()) .self(getApplicationLocation(applicationResponseModel.getId())) .applicationEnabled(applicationResponseModel.getApplicationEnabled()) + .organizationCustomRolesEnabled(applicationResponseModel.getOrganizationCustomRolesEnabled()) .associatedRoles(excludeAssociatedRoles(applicationResponseModel.getAssociatedRoles())); } diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ServiceProviderToApiModel.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ServiceProviderToApiModel.java index 54dafaebc4..df3cb90617 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ServiceProviderToApiModel.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/ServiceProviderToApiModel.java @@ -140,6 +140,7 @@ public ApplicationResponseModel apply(ServiceProvider application) { .isManagementApp(application.isManagementApp()) .applicationEnabled(application.isApplicationEnabled()) .enhancedOrgAuthenticationEnabled(application.isEnhancedOrganizationAuthenticationEnabled()) + .organizationCustomRolesEnabled(application.isOrganizationCustomRolesEnabled()) .associatedRoles(buildAssociatedRoles(application)) .claimConfiguration(buildClaimConfiguration(application)) .inboundProtocols(buildInboundProtocols(application)) diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/UpdateServiceProvider.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/UpdateServiceProvider.java index d9cd0a8631..9ef4598e92 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/UpdateServiceProvider.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/UpdateServiceProvider.java @@ -48,6 +48,8 @@ public void apply(ServiceProvider serviceProvider, ApplicationPatchModel applica setIfNotNull(applicationPatchModel.getApplicationEnabled(), serviceProvider::setApplicationEnabled); setIfNotNull(applicationPatchModel.getEnhancedOrgAuthenticationEnabled(), serviceProvider::setEnhancedOrganizationAuthenticationEnabled); + setIfNotNull(applicationPatchModel.getOrganizationCustomRolesEnabled(), + serviceProvider::setOrganizationCustomRolesEnabled); patchAssociatedRolesConfigurations(serviceProvider, applicationPatchModel.getAssociatedRoles()); patchClaimConfiguration(serviceProvider, applicationPatchModel.getClaimConfiguration()); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml index fb9d873f96..f4231e902c 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml @@ -3401,6 +3401,9 @@ components: enhancedOrgAuthenticationEnabled: type: boolean example: false + organizationCustomRolesEnabled: + type: boolean + example: false applicationEnabled: type: boolean example: true @@ -3449,6 +3452,11 @@ components: type: boolean example: false description: Decides whether the enhanced organization authentication is enabled for the application. + organizationCustomRolesEnabled: + type: boolean + example: false + description: For a main application, decides whether organizations can create custom roles for its + shared applications. applicationEnabled: default: true type: boolean @@ -3521,6 +3529,11 @@ components: type: boolean example: false description: Decides whether the enhanced organization authentication is enabled for the application. + organizationCustomRolesEnabled: + type: boolean + example: false + description: For a main application, decides whether organizations can create custom roles for its + shared applications. applicationEnabled: type: boolean example: true @@ -3575,6 +3588,11 @@ components: type: boolean example: false description: Decides whether the enhanced organization authentication is enabled for the application. + organizationCustomRolesEnabled: + type: boolean + example: false + description: For a main application, decides whether organizations can create custom roles for its + shared applications. applicationEnabled: type: boolean example: true diff --git a/pom.xml b/pom.xml index f2c9ba2011..198472399e 100644 --- a/pom.xml +++ b/pom.xml @@ -1170,7 +1170,7 @@ 1.4 1.2.4 1.11.103 - 7.11.268 + 7.11.269 3.0.5 4.9.8.2 4.9.8