Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce config to send unsplitted SAML multi valued attributes #424

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class SAMLSSOConstants {
public static final String SAML_SP_CERTIFICATE_EXPIRY_VALIDATION_ENABLED = "SSOService.SAMLSPCertificateExpiryValidationEnable";
public static final String SAML_IDP_INIT_LOGOUT_RESPONSE_SIGNING_ENABLED = "SSOService.SAMLIdpInitLogoutResponseSigningEnabled";
public static final String SAML_ASSERTION_ENCRYPT_WITH_APP_CERT = "SSOService.SAMLAssertionEncyptWithAppCert";
public static final String SEPARATE_MULTI_ATTRS_FROM_IDPS_USING_ATTRIBUTE_SEPARATOR = "SSOService.SeparateMultiAttributesFromIdP";
public static final String START_SOAP_BINDING = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
"<SOAP-ENV:Body>";
public static final String END_SOAP_BINDING = "</SOAP-ENV:Body>" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,23 @@ protected AttributeStatement buildAttributeStatement(Map<String, String> claims)
String claimSeparator = claims.get(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
String userAttributeSeparator;
if (StringUtils.isNotBlank(claimSeparator)) {
userAttributeSeparator = claimSeparator;
} else {
/*
* In the SAML outbound authenticator, multivalued attributes are concatenated using the primary user
* store's attribute separator. Therefore, to ensure uniformity, the multi-attribute separator from
* the primary user store is utilized for separating multivalued attributes when MultiAttributeSeparator
* is not available in the claims.
If there are any sp requested claims, then the multi attribute separator claim will be available.
*/
userAttributeSeparator = FrameworkUtils.getMultiAttributeSeparator();
userAttributeSeparator = claimSeparator;
} else {
if (!SAMLSSOUtil.separateMultiAttributesFromIdPEnabled()) {
userAttributeSeparator = IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR_DEFAULT;
} else {
/*
* In the SAML outbound authenticator, multivalued attributes are concatenated using the primary user
* store's attribute separator. Therefore, to ensure uniformity, the multi-attribute separator from
* the primary user store is utilized for separating multivalued attributes when MultiAttributeSeparator
* is not available in the claims.
*/
userAttributeSeparator = FrameworkUtils.getMultiAttributeSeparator();
}

}
claims.remove(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
claims.remove(FrameworkConstants.IDP_MAPPED_USER_ROLES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2756,4 +2756,23 @@ public static boolean isSAMLIdpInitLogoutResponseSigningEnabled() {
return Boolean.parseBoolean(IdentityUtil.getProperty(
SAMLSSOConstants.SAML_IDP_INIT_LOGOUT_RESPONSE_SIGNING_ENABLED));
}

/**
* SeparateMultiAttributesFromIdP config is used to separate the multi-valued attributes sent from the IdPs.
* This config is used when the SP doesn't request any claim in IS, and all the claims from the IdP are passed
* to the SP.
*
* @return false if 'separateMultiAttributesFromIdP' config is disabled. By default, this config is enabled in the
* product.
*/
public static boolean separateMultiAttributesFromIdPEnabled() {

String separateMultiAttributesFromIdPEnabledConfig = IdentityUtil.getProperty(
SAMLSSOConstants.SEPARATE_MULTI_ATTRS_FROM_IDPS_USING_ATTRIBUTE_SEPARATOR);
if (StringUtils.isNotEmpty(separateMultiAttributesFromIdPEnabledConfig)) {
return Boolean.parseBoolean(separateMultiAttributesFromIdPEnabledConfig);
} else {
return true;
}
}
}
Loading