From 0ece634a2898ea2c898149053a82b50dcc423516 Mon Sep 17 00:00:00 2001 From: Hasanthi Dissanayake Date: Wed, 10 Jan 2024 09:13:06 +0530 Subject: [PATCH] Set NameId options --- .../authenticator/samlsso/SAMLSSOAuthenticator.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/org.wso2.carbon.identity.application.authenticator.samlsso/src/main/java/org/wso2/carbon/identity/application/authenticator/samlsso/SAMLSSOAuthenticator.java b/components/org.wso2.carbon.identity.application.authenticator.samlsso/src/main/java/org/wso2/carbon/identity/application/authenticator/samlsso/SAMLSSOAuthenticator.java index 59953403..246a1ad2 100644 --- a/components/org.wso2.carbon.identity.application.authenticator.samlsso/src/main/java/org/wso2/carbon/identity/application/authenticator/samlsso/SAMLSSOAuthenticator.java +++ b/components/org.wso2.carbon.identity.application.authenticator.samlsso/src/main/java/org/wso2/carbon/identity/application/authenticator/samlsso/SAMLSSOAuthenticator.java @@ -84,6 +84,14 @@ public class SAMLSSOAuthenticator extends AbstractApplicationAuthenticator private static final String AUTH_PARAM = "$authparam"; private static final String DYNAMIC_AUTH_PARAMS_LOOKUP_REGEX = "\\$authparam\\{(\\w+)}"; private static final Pattern authParamDynamicQueryPattern = Pattern.compile(DYNAMIC_AUTH_PARAMS_LOOKUP_REGEX); + private String[] samlNameIdFormats = { + "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", + "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", + "urn:oasis:names:tc:SAML:2.0:nameid-format:entity", + "urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted", + "urn:oasis:names:tc:SAML:2.0:nameid-format:transient", + "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" + }; private static final Log log = LogFactory.getLog(SAMLSSOAuthenticator.class); @@ -573,6 +581,7 @@ public List getConfigurationProperties() { nameIdFormat.setDescription("NameID format to be used in the SAML request"); nameIdFormat.setType("string"); nameIdFormat.setDisplayOrder(2); + nameIdFormat.setOptions(samlNameIdFormats); nameIdFormat.setDefaultValue(IdentityApplicationConstants.Authenticator.SAML2SSO.UNSPECIFIED_NAME_ID_FORMAT); configProperties.add(nameIdFormat);