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 aa12ee9581..f3b4351156 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
@@ -132,6 +132,9 @@ public enum ErrorMessage {
INVALID_POLICY_TYPE_FOR_API_RESOURCE("60512", "Invalid policy type provided for the API " +
"resource.", "API resource with id: %s doesn't allow the provided policy type: %s."),
+ ERROR_ASSERT_LOCAL_SUBJECT_IDENTIFIER_DISABLED("60513",
+ "Invalid configuration.",
+ "'useMappedLocalSubject' cannot be disabled when 'mappedLocalSubjectMandatory' is enabled."),
// Server Errors.
ERROR_RETRIEVING_SAML_METADATA("65001",
"Error occurred while retrieving SAML Metadata.",
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/SubjectConfig.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/SubjectConfig.java
index ce244fbf2c..3997c6701e 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/SubjectConfig.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/SubjectConfig.java
@@ -37,6 +37,7 @@ public class SubjectConfig {
private Boolean includeUserDomain;
private Boolean includeTenantDomain;
private Boolean useMappedLocalSubject;
+ private Boolean mappedLocalSubjectMandatory;
/**
**/
@@ -110,6 +111,24 @@ public void setUseMappedLocalSubject(Boolean useMappedLocalSubject) {
this.useMappedLocalSubject = useMappedLocalSubject;
}
+ /**
+ **/
+ public SubjectConfig mappedLocalSubjectMandatory(Boolean mappedLocalSubjectMandatory) {
+
+ this.mappedLocalSubjectMandatory = mappedLocalSubjectMandatory;
+ return this;
+ }
+
+ @ApiModelProperty(example = "false", value = "")
+ @JsonProperty("mappedLocalSubjectMandatory")
+ @Valid
+ public Boolean getMappedLocalSubjectMandatory() {
+ return mappedLocalSubjectMandatory;
+ }
+ public void setMappedLocalSubjectMandatory(Boolean mappedLocalSubjectMandatory) {
+ this.mappedLocalSubjectMandatory = mappedLocalSubjectMandatory;
+ }
+
@Override
@@ -125,12 +144,13 @@ public boolean equals(java.lang.Object o) {
return Objects.equals(this.claim, subjectConfig.claim) &&
Objects.equals(this.includeUserDomain, subjectConfig.includeUserDomain) &&
Objects.equals(this.includeTenantDomain, subjectConfig.includeTenantDomain) &&
- Objects.equals(this.useMappedLocalSubject, subjectConfig.useMappedLocalSubject);
+ Objects.equals(this.useMappedLocalSubject, subjectConfig.useMappedLocalSubject) &&
+ Objects.equals(this.mappedLocalSubjectMandatory, subjectConfig.mappedLocalSubjectMandatory);
}
@Override
public int hashCode() {
- return Objects.hash(claim, includeUserDomain, includeTenantDomain, useMappedLocalSubject);
+ return Objects.hash(claim, includeUserDomain, includeTenantDomain, useMappedLocalSubject, mappedLocalSubjectMandatory);
}
@Override
@@ -143,6 +163,7 @@ public String toString() {
sb.append(" includeUserDomain: ").append(toIndentedString(includeUserDomain)).append("\n");
sb.append(" includeTenantDomain: ").append(toIndentedString(includeTenantDomain)).append("\n");
sb.append(" useMappedLocalSubject: ").append(toIndentedString(useMappedLocalSubject)).append("\n");
+ sb.append(" mappedLocalSubjectMandatory: ").append(toIndentedString(mappedLocalSubjectMandatory)).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/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 8be7aa8af3..39f3483215 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
@@ -306,6 +306,7 @@ private SubjectConfig buildSubjectClaimConfig(ServiceProvider application) {
if (application.getClaimConfig() != null) {
subjectConfig.useMappedLocalSubject(application.getClaimConfig().isAlwaysSendMappedLocalSubjectId());
+ subjectConfig.mappedLocalSubjectMandatory(application.getClaimConfig().isMappedLocalSubjectMandatory());
}
LocalAndOutboundAuthenticationConfig localAndOutboundAuthConfig =
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/UpdateClaimConfiguration.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/UpdateClaimConfiguration.java
index cdf0f1f86a..79f2b43dc4 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/UpdateClaimConfiguration.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/UpdateClaimConfiguration.java
@@ -35,6 +35,8 @@
import java.util.Optional;
import java.util.stream.Collectors;
+import static org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants.ErrorMessage.ERROR_ASSERT_LOCAL_SUBJECT_IDENTIFIER_DISABLED;
+import static org.wso2.carbon.identity.api.server.application.management.v1.core.functions.Utils.buildBadRequestError;
import static org.wso2.carbon.identity.api.server.application.management.v1.core.functions.Utils.setIfNotNull;
/**
@@ -131,6 +133,12 @@ private void updateSubjectClaimConfigs(SubjectConfig subjectApiModel, ServicePro
if (subjectApiModel != null) {
+ if (Boolean.TRUE.equals(subjectApiModel.getMappedLocalSubjectMandatory()) &&
+ Boolean.FALSE.equals(subjectApiModel.getUseMappedLocalSubject())) {
+ throw buildBadRequestError(ERROR_ASSERT_LOCAL_SUBJECT_IDENTIFIER_DISABLED.getCode(),
+ ERROR_ASSERT_LOCAL_SUBJECT_IDENTIFIER_DISABLED.getDescription());
+ }
+
LocalAndOutboundAuthenticationConfig authConfig = getLocalAndOutboundConfig(application);
if (subjectApiModel.getClaim() != null) {
setIfNotNull(subjectApiModel.getClaim().getUri(), authConfig::setSubjectClaimUri);
@@ -142,6 +150,7 @@ private void updateSubjectClaimConfigs(SubjectConfig subjectApiModel, ServicePro
ClaimConfig claimConfig = getClaimConfig(application);
setIfNotNull(subjectApiModel.getUseMappedLocalSubject(), claimConfig::setAlwaysSendMappedLocalSubjectId);
+ setIfNotNull(subjectApiModel.getMappedLocalSubjectMandatory(), claimConfig::setMappedLocalSubjectMandatory);
}
}
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 043dfd7eb7..1587cc8d14 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
@@ -2934,6 +2934,9 @@ components:
useMappedLocalSubject:
type: boolean
example: false
+ mappedLocalSubjectMandatory:
+ type: boolean
+ example: false
RoleConfig:
type: object
properties:
diff --git a/pom.xml b/pom.xml
index a7d8a2ae62..e4ebf51d4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -760,7 +760,7 @@
1.4
1.2.4
1.8.62
- 5.25.430
+ 5.25.481
3.0.5
5.2.0
**/gen/**/*