Search in sources :

Example 16 with SAML2Config

use of org.forgerock.openam.sts.config.user.SAML2Config in project OpenAM by OpenRock.

the class RestSTSInstanceStateServiceListenerTest method createInstanceConfig.

private RestSTSInstanceConfig createInstanceConfig(String issuerName) {
    Map<String, String> context = new HashMap<>();
    context.put(AMSTSConstants.OPEN_ID_CONNECT_ID_TOKEN_AUTH_TARGET_HEADER_KEY, "oidc_id_token");
    AuthTargetMapping mapping = AuthTargetMapping.builder().addMapping(TokenType.USERNAME, "service", "ldapService").addMapping(TokenType.OPENIDCONNECT, "module", "oidc", context).build();
    DeploymentConfig deploymentConfig = DeploymentConfig.builder().uriElement(DEPLOYMENT_URL_ELEMENT).authTargetMapping(mapping).build();
    Map<String, String> attributes = new HashMap<>();
    attributes.put("email", "mail");
    SAML2Config saml2Config = SAML2Config.builder().attributeMap(attributes).nameIdFormat("urn:oasis:names:tc:SAML:2.0:nameid-format:persistent").spEntityId("http://host.com/sp/entity/id").idpId(issuerName).build();
    return RestSTSInstanceConfig.builder().deploymentConfig(deploymentConfig).saml2Config(saml2Config).addSupportedTokenTransform(TokenType.X509, TokenType.SAML2, !AMSTSConstants.INVALIDATE_INTERIM_OPENAM_SESSION).addSupportedTokenTransform(TokenType.USERNAME, TokenType.SAML2, AMSTSConstants.INVALIDATE_INTERIM_OPENAM_SESSION).addSupportedTokenTransform(TokenType.OPENAM, TokenType.SAML2, !AMSTSConstants.INVALIDATE_INTERIM_OPENAM_SESSION).addSupportedTokenTransform(TokenType.OPENIDCONNECT, TokenType.SAML2, AMSTSConstants.INVALIDATE_INTERIM_OPENAM_SESSION).build();
}
Also used : SAML2Config(org.forgerock.openam.sts.config.user.SAML2Config) HashMap(java.util.HashMap) AuthTargetMapping(org.forgerock.openam.sts.config.user.AuthTargetMapping) DeploymentConfig(org.forgerock.openam.sts.config.user.DeploymentConfig)

Aggregations

SAML2Config (org.forgerock.openam.sts.config.user.SAML2Config)16 HashMap (java.util.HashMap)9 AuthTargetMapping (org.forgerock.openam.sts.config.user.AuthTargetMapping)9 DeploymentConfig (org.forgerock.openam.sts.config.user.DeploymentConfig)6 OpenIdConnectTokenConfig (org.forgerock.openam.sts.config.user.OpenIdConnectTokenConfig)5 SoapDeploymentConfig (org.forgerock.openam.sts.soap.config.user.SoapDeploymentConfig)4 SoapSTSKeystoreConfig (org.forgerock.openam.sts.soap.config.user.SoapSTSKeystoreConfig)4 SoapSTSInstanceConfig (org.forgerock.openam.sts.soap.config.user.SoapSTSInstanceConfig)3 SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)2 HashSet (java.util.HashSet)2 JsonValue (org.forgerock.json.JsonValue)2 TokenCreationException (org.forgerock.openam.sts.TokenCreationException)2 Test (org.testng.annotations.Test)2 Assertion (com.sun.identity.saml2.assertion.Assertion)1 EncryptedAssertion (com.sun.identity.saml2.assertion.EncryptedAssertion)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 PrivateKey (java.security.PrivateKey)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 QName (javax.xml.namespace.QName)1