From d943b8a9e3d611d9a3d820127cc82ce5b03527e4 Mon Sep 17 00:00:00 2001 From: Stefan Guilhen Date: Tue, 4 Feb 2020 22:13:00 -0300 Subject: [PATCH] [KEYCLOAK-12873] Fix differences between keycloak-saml.xml (adapter) and the keycloak-saml subsystem --- .../subsystem/saml/as7/Constants.java | 30 + .../saml/as7/HttpClientDefinition.java | 95 +++ .../saml/as7/IdentityProviderDefinition.java | 31 +- .../saml/as7/KeycloakSamlExtension.java | 13 +- .../saml/as7/KeycloakSubsystemParser.java | 28 + .../saml/as7/ServiceProviderDefinition.java | 27 +- .../saml/as7/LocalDescriptions.properties | 11 + .../schema/wildfly-keycloak-saml_1_3.xsd | 570 ++++++++++++++++++ ...systemParsingAllowedClockSkewTestCase.java | 2 +- .../saml/as7/SubsystemParsingTestCase.java | 2 +- .../subsystem/saml/as7/keycloak-saml-1.3.xml} | 21 +- .../schema/keycloak_saml_adapter_1_12.xsd | 10 + .../adapter/saml/extension/Constants.java | 31 +- .../saml/extension/HttpClientDefinition.java | 95 +++ .../extension/IdentityProviderDefinition.java | 31 +- .../saml/extension/KeycloakSamlExtension.java | 13 +- .../extension/KeycloakSubsystemParser.java | 29 + .../extension/ServiceProviderDefinition.java | 27 +- .../extension/LocalDescriptions.properties | 11 + .../schema/wildfly-keycloak-saml_1_3.xsd | 570 ++++++++++++++++++ .../keycloak-saml-adapter.xml | 2 +- ...systemParsingAllowedClockSkewTestCase.java | 4 +- .../extension/SubsystemParsingTestCase.java | 4 +- .../saml/extension/keycloak-saml-1.2-err.xml | 68 --- .../saml/extension/keycloak-saml-1.3.xml} | 25 +- 25 files changed, 1615 insertions(+), 135 deletions(-) create mode 100644 adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/HttpClientDefinition.java create mode 100755 adapters/saml/as7-eap6/subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_3.xsd rename adapters/saml/{wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.2.xml => as7-eap6/subsystem/src/test/resources/org/keycloak/subsystem/saml/as7/keycloak-saml-1.3.xml} (79%) create mode 100644 adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/HttpClientDefinition.java create mode 100755 adapters/saml/wildfly/wildfly-subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_3.xsd delete mode 100644 adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.2-err.xml rename adapters/saml/{as7-eap6/subsystem/src/test/resources/org/keycloak/subsystem/saml/as7/keycloak-saml-1.2.xml => wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.3.xml} (79%) diff --git a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/Constants.java b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/Constants.java index a59daf1607..1ca02718db 100755 --- a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/Constants.java +++ b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/Constants.java @@ -32,6 +32,7 @@ public class Constants { static final String KEEP_DOM_ASSERTION = "keepDOMAssertion"; static final String IS_PASSIVE = "isPassive"; static final String TURN_OFF_CHANGE_SESSSION_ID_ON_LOGIN = "turnOffChangeSessionIdOnLogin"; + static final String AUTODETECT_BEARER_ONLY = "autodetectBearerOnly"; static final String ROLE_ATTRIBUTES = "RoleIdentifiers"; static final String SIGNING = "signing"; static final String ENCRYPTION = "encryption"; @@ -62,6 +63,7 @@ public class Constants { static final String PRINCIPAL_NAME_MAPPING_ATTRIBUTE_NAME = "PrincipalNameMapping-attribute-name"; static final String SIGNATURE_ALGORITHM = "signatureAlgorithm"; static final String SIGNATURE_CANONICALIZATION_METHOD = "signatureCanonicalizationMethod"; + static final String METADATA_URL = "metadataUrl"; static final String PRIVATE_KEY_PEM = "PrivateKeyPem"; static final String PUBLIC_KEY_PEM = "PublicKeyPem"; static final String CERTIFICATE_PEM = "CertificatePem"; @@ -70,12 +72,25 @@ public class Constants { static final String FILE = "file"; static final String SIGNATURES_REQUIRED = "signaturesRequired"; + // role mappings provider model constants. static final String ROLE_MAPPINGS_PROVIDER_ID = "roleMappingsProviderId"; static final String ROLE_MAPPINGS_PROVIDER_CONFIG = "roleMappingsProviderConfig"; + // allowed clock skew model constants static final String ALLOWED_CLOCK_SKEW = "AllowedClockSkew"; static final String ALLOWED_CLOCK_SKEW_UNIT = "unit"; static final String ALLOWED_CLOCK_SKEW_VALUE = "value"; + + // http client model constants + static final String HTTP_CLIENT = "HttpClient"; + static final String ALLOW_ANY_HOSTNAME = "allowAnyHostname"; + static final String CLIENT_KEYSTORE = "clientKeystore"; + static final String CLIENT_KEYSTORE_PASSWORD = "clientKeystorePassword"; + static final String CONNECTION_POOL_SIZE = "connectionPoolSize"; + static final String DISABLE_TRUST_MANAGER = "disableTrustManager"; + static final String PROXY_URL = "proxyUrl"; + static final String TRUSTSTORE = "truststore"; + static final String TRUSTSTORE_PASSWORD = "truststorePassword"; } static class XML { @@ -101,6 +116,7 @@ public class Constants { static final String CERTIFICATE = "Certificate"; static final String IS_PASSIVE = "isPassive"; static final String TURN_OFF_CHANGE_SESSSION_ID_ON_LOGIN = "turnOffChangeSessionIdOnLogin"; + static final String AUTODETECT_BEARER_ONLY = "autodetectBearerOnly"; static final String PRIVATE_KEY_ALIAS = "alias"; static final String PRIVATE_KEY_PASSWORD = "password"; @@ -124,6 +140,7 @@ public class Constants { static final String ATTRIBUTE = "Attribute"; static final String SIGNATURE_ALGORITHM = "signatureAlgorithm"; static final String SIGNATURE_CANONICALIZATION_METHOD = "signatureCanonicalizationMethod"; + static final String METADATA_URL = "metadataUrl"; static final String PRIVATE_KEY_PEM = "PrivateKeyPem"; static final String PUBLIC_KEY_PEM = "PublicKeyPem"; static final String CERTIFICATE_PEM = "CertificatePem"; @@ -133,12 +150,25 @@ public class Constants { static final String SIGNATURES_REQUIRED = "signaturesRequired"; static final String ASSERTION_CONSUMER_SERVICE_URL = "assertionConsumerServiceUrl"; + // role mappings provider XML constants static final String ID = "id"; static final String VALUE = "value"; static final String PROPERTY = "Property"; static final String ROLE_MAPPINGS_PROVIDER = "RoleMappingsProvider"; + // allowed clock skew XML constants static final String ALLOWED_CLOCK_SKEW = "AllowedClockSkew"; static final String ALLOWED_CLOCK_SKEW_UNIT = "unit"; + + // http client XML constants + static final String HTTP_CLIENT = "HttpClient"; + static final String ALLOW_ANY_HOSTNAME = "allowAnyHostname"; + static final String CLIENT_KEYSTORE = "clientKeystore"; + static final String CLIENT_KEYSTORE_PASSWORD = "clientKeystorePassword"; + static final String CONNECTION_POOL_SIZE = "connectionPoolSize"; + static final String DISABLE_TRUST_MANAGER = "disableTrustManager"; + static final String PROXY_URL = "proxyUrl"; + static final String TRUSTSTORE = "truststore"; + static final String TRUSTSTORE_PASSWORD = "truststorePassword"; } } diff --git a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/HttpClientDefinition.java b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/HttpClientDefinition.java new file mode 100644 index 0000000000..b97f1d21d3 --- /dev/null +++ b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/HttpClientDefinition.java @@ -0,0 +1,95 @@ +/* + * Copyright 2020 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.keycloak.subsystem.saml.as7; + +import java.util.HashMap; + +import org.jboss.as.controller.SimpleAttributeDefinition; +import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; +import org.jboss.dmr.ModelType; + +/** + * This class contains the definitions for the {@code HttpClient} attributes, as specified in the schema's {@code http-client-type} + * complex type. + * + * @author Stefan Guilhen + */ +abstract class HttpClientDefinition { + + private static final SimpleAttributeDefinition ALLOW_ANY_HOSTNAME = + new SimpleAttributeDefinitionBuilder(Constants.Model.ALLOW_ANY_HOSTNAME, ModelType.BOOLEAN, true) + .setXmlName(Constants.XML.ALLOW_ANY_HOSTNAME) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition CLIENT_KEYSTORE = + new SimpleAttributeDefinitionBuilder(Constants.Model.CLIENT_KEYSTORE, ModelType.STRING, true) + .setXmlName(Constants.XML.CLIENT_KEYSTORE) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition CLIENT_KEYSTORE_PASSWORD = + new SimpleAttributeDefinitionBuilder(Constants.Model.CLIENT_KEYSTORE_PASSWORD, ModelType.STRING, true) + .setXmlName(Constants.XML.CLIENT_KEYSTORE_PASSWORD) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition CONNECTION_POOL_SIZE = + new SimpleAttributeDefinitionBuilder(Constants.Model.CONNECTION_POOL_SIZE, ModelType.INT, true) + .setXmlName(Constants.XML.CONNECTION_POOL_SIZE) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition DISABLE_TRUST_MANAGER = + new SimpleAttributeDefinitionBuilder(Constants.Model.DISABLE_TRUST_MANAGER, ModelType.BOOLEAN, true) + .setXmlName(Constants.XML.DISABLE_TRUST_MANAGER) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition PROXY_URL = + new SimpleAttributeDefinitionBuilder(Constants.Model.PROXY_URL, ModelType.STRING, true) + .setXmlName(Constants.XML.PROXY_URL) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition TRUSTSTORE = + new SimpleAttributeDefinitionBuilder(Constants.Model.TRUSTSTORE, ModelType.STRING, true) + .setXmlName(Constants.XML.TRUSTSTORE) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition TRUSTSTORE_PASSWORD = + new SimpleAttributeDefinitionBuilder(Constants.Model.TRUSTSTORE_PASSWORD, ModelType.STRING, true) + .setXmlName(Constants.XML.TRUSTSTORE_PASSWORD) + .setAllowExpression(true) + .build(); + + static final SimpleAttributeDefinition[] ATTRIBUTES = {ALLOW_ANY_HOSTNAME, CLIENT_KEYSTORE, CLIENT_KEYSTORE_PASSWORD, + CONNECTION_POOL_SIZE, DISABLE_TRUST_MANAGER, PROXY_URL, TRUSTSTORE, TRUSTSTORE_PASSWORD}; + + private static final HashMap ATTRIBUTE_MAP = new HashMap<>(); + + static { + for (SimpleAttributeDefinition def : ATTRIBUTES) { + ATTRIBUTE_MAP.put(def.getXmlName(), def); + } + } + + static SimpleAttributeDefinition lookup(String xmlName) { + return ATTRIBUTE_MAP.get(xmlName); + } +} diff --git a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/IdentityProviderDefinition.java b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/IdentityProviderDefinition.java index aac3f2815c..ce88abbe79 100644 --- a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/IdentityProviderDefinition.java +++ b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/IdentityProviderDefinition.java @@ -36,44 +36,57 @@ import java.util.HashMap; */ public class IdentityProviderDefinition extends SimpleResourceDefinition { - static final SimpleAttributeDefinition SIGNATURES_REQUIRED = + private static final SimpleAttributeDefinition SIGNATURES_REQUIRED = new SimpleAttributeDefinitionBuilder(Constants.Model.SIGNATURES_REQUIRED, ModelType.BOOLEAN, true) .setXmlName(Constants.XML.SIGNATURES_REQUIRED) .build(); - static final SimpleAttributeDefinition SIGNATURE_ALGORITHM = + private static final SimpleAttributeDefinition SIGNATURE_ALGORITHM = new SimpleAttributeDefinitionBuilder(Constants.Model.SIGNATURE_ALGORITHM, ModelType.STRING, true) .setXmlName(Constants.XML.SIGNATURE_ALGORITHM) .build(); - static final SimpleAttributeDefinition SIGNATURE_CANONICALIZATION_METHOD = + private static final SimpleAttributeDefinition SIGNATURE_CANONICALIZATION_METHOD = new SimpleAttributeDefinitionBuilder(Constants.Model.SIGNATURE_CANONICALIZATION_METHOD, ModelType.STRING, true) .setXmlName(Constants.XML.SIGNATURE_CANONICALIZATION_METHOD) .build(); - static final ObjectTypeAttributeDefinition SINGLE_SIGN_ON = + private static final SimpleAttributeDefinition METADATA_URL = + new SimpleAttributeDefinitionBuilder(Constants.Model.METADATA_URL, ModelType.STRING, true) + .setXmlName(Constants.XML.METADATA_URL) + .setAllowExpression(true) + .build(); + + private static final ObjectTypeAttributeDefinition SINGLE_SIGN_ON = ObjectTypeAttributeDefinition.Builder.of(Constants.Model.SINGLE_SIGN_ON, SingleSignOnDefinition.ATTRIBUTES) .setAllowNull(false) .build(); - static final ObjectTypeAttributeDefinition SINGLE_LOGOUT = + private static final ObjectTypeAttributeDefinition SINGLE_LOGOUT = ObjectTypeAttributeDefinition.Builder.of(Constants.Model.SINGLE_LOGOUT, SingleLogoutDefinition.ATTRIBUTES) .setAllowNull(false) .build(); - static final ObjectTypeAttributeDefinition ALLOWED_CLOCK_SKEW = + private static final ObjectTypeAttributeDefinition ALLOWED_CLOCK_SKEW = ObjectTypeAttributeDefinition.Builder.of(Constants.Model.ALLOWED_CLOCK_SKEW, AllowedClockSkew.ATTRIBUTES) .setAllowNull(true) .build(); - static final SimpleAttributeDefinition[] ATTRIBUTES = {SIGNATURES_REQUIRED, SIGNATURE_ALGORITHM, SIGNATURE_CANONICALIZATION_METHOD}; + private static final ObjectTypeAttributeDefinition HTTP_CLIENT = + ObjectTypeAttributeDefinition.Builder.of(Constants.Model.HTTP_CLIENT, + HttpClientDefinition.ATTRIBUTES) + .setAllowNull(true) + .build(); - static final SimpleAttributeDefinition[] ALL_ATTRIBUTES = {SIGNATURES_REQUIRED, SIGNATURE_ALGORITHM, SIGNATURE_CANONICALIZATION_METHOD, SINGLE_SIGN_ON, SINGLE_LOGOUT, ALLOWED_CLOCK_SKEW}; + static final SimpleAttributeDefinition[] ATTRIBUTES = {SIGNATURES_REQUIRED, SIGNATURE_ALGORITHM, SIGNATURE_CANONICALIZATION_METHOD, METADATA_URL}; - static final HashMap ATTRIBUTE_MAP = new HashMap<>(); + static final SimpleAttributeDefinition[] ALL_ATTRIBUTES = {SIGNATURES_REQUIRED, SIGNATURE_ALGORITHM, SIGNATURE_CANONICALIZATION_METHOD, METADATA_URL, + SINGLE_SIGN_ON, SINGLE_LOGOUT, ALLOWED_CLOCK_SKEW, HTTP_CLIENT}; + + private static final HashMap ATTRIBUTE_MAP = new HashMap<>(); static { for (SimpleAttributeDefinition def : ALL_ATTRIBUTES) { diff --git a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/KeycloakSamlExtension.java b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/KeycloakSamlExtension.java index e393af67ed..7b3631a9bd 100755 --- a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/KeycloakSamlExtension.java +++ b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/KeycloakSamlExtension.java @@ -35,17 +35,19 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUB */ public class KeycloakSamlExtension implements Extension { - public static final String SUBSYSTEM_NAME = "keycloak-saml"; - public static final String NAMESPACE_1_1 = "urn:jboss:domain:keycloak-saml:1.1"; - public static final String NAMESPACE_1_2 = "urn:jboss:domain:keycloak-saml:1.2"; - public static final String CURRENT_NAMESPACE = NAMESPACE_1_2; + static final String SUBSYSTEM_NAME = "keycloak-saml"; + private static final String NAMESPACE_1_1 = "urn:jboss:domain:keycloak-saml:1.1"; + private static final String NAMESPACE_1_2 = "urn:jboss:domain:keycloak-saml:1.2"; + private static final String NAMESPACE_1_3 = "urn:jboss:domain:keycloak-saml:1.3"; + + static final String CURRENT_NAMESPACE = NAMESPACE_1_3; private static final KeycloakSubsystemParser PARSER = new KeycloakSubsystemParser(); static final PathElement PATH_SUBSYSTEM = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME); private static final String RESOURCE_NAME = KeycloakSamlExtension.class.getPackage().getName() + ".LocalDescriptions"; private static final ModelVersion MGMT_API_VERSION = ModelVersion.create(1, 1, 0); static final PathElement SUBSYSTEM_PATH = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME); - public static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { + static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME); for (String kp : keyPrefix) { prefix.append('.').append(kp); @@ -60,6 +62,7 @@ public class KeycloakSamlExtension implements Extension { public void initializeParsers(final ExtensionParsingContext context) { context.setSubsystemXmlMapping(SUBSYSTEM_NAME, KeycloakSamlExtension.NAMESPACE_1_1, PARSER); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, KeycloakSamlExtension.NAMESPACE_1_2, PARSER); + context.setSubsystemXmlMapping(SUBSYSTEM_NAME, KeycloakSamlExtension.NAMESPACE_1_3, PARSER); } /** diff --git a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/KeycloakSubsystemParser.java b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/KeycloakSubsystemParser.java index 524825653f..1b4275bdb9 100755 --- a/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/KeycloakSubsystemParser.java +++ b/adapters/saml/as7-eap6/subsystem/src/main/java/org/keycloak/subsystem/saml/as7/KeycloakSubsystemParser.java @@ -161,6 +161,8 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader
  • ATTRIBUTE_MAP = new HashMap<>(); - static final HashMap ALL_MAP = new HashMap<>(); + private static final HashMap ATTRIBUTE_MAP = new HashMap<>(); + private static final HashMap ALL_MAP = new HashMap<>(); static final Collection ALL_ATTRIBUTES; static { diff --git a/adapters/saml/as7-eap6/subsystem/src/main/resources/org/keycloak/subsystem/saml/as7/LocalDescriptions.properties b/adapters/saml/as7-eap6/subsystem/src/main/resources/org/keycloak/subsystem/saml/as7/LocalDescriptions.properties index 849da7a51c..d3329ecfc0 100755 --- a/adapters/saml/as7-eap6/subsystem/src/main/resources/org/keycloak/subsystem/saml/as7/LocalDescriptions.properties +++ b/adapters/saml/as7-eap6/subsystem/src/main/resources/org/keycloak/subsystem/saml/as7/LocalDescriptions.properties @@ -35,6 +35,7 @@ keycloak-saml.SP.forceAuthentication=Redirected unauthenticated request to a log keycloak-saml.SP.keepDOMAssertion=Attribute to inject the DOM representation of the assertion into the SamlPrincipal (respecting the original syntax) keycloak-saml.SP.isPassive=If user isn't logged in just return with an error. Used to check if a user is already logged in or not keycloak-saml.SP.turnOffChangeSessionIdOnLogin=The session id is changed by default on a successful login. Change this to true if you want to turn this off +keycloak-saml.SP.autodetectBearerOnly=Set to true if the application serves both a web application and web services (e.g. SOAP or REST). It allows redirection of unauthenticated users of the web application to the Keycloak login page, but send an HTTP 401 status code to unauthenticated SOAP or REST clients instead keycloak-saml.SP.RoleIdentifiers=Role identifiers keycloak-saml.SP.PrincipalNameMapping-policy=Principal name mapping policy keycloak-saml.SP.PrincipalNameMapping-attribute-name=Principal name mapping attribute name @@ -68,6 +69,7 @@ keycloak-saml.IDP.remove=Remove an identity provider keycloak-saml.IDP.signaturesRequired=Require signatures for SingleSignOnService and SingleLogoutService keycloak-saml.IDP.signatureAlgorithm=Signature algorithm keycloak-saml.IDP.signatureCanonicalizationMethod=Signature canonicalization method +keycloak-saml.IDP.metadataUrl=The URL used to retrieve the IDP metadata from keycloak-saml.IDP.SingleSignOnService=Single sign-on configuration keycloak-saml.IDP.SingleSignOnService.signRequest=Sign SSO requests keycloak-saml.IDP.SingleSignOnService.validateResponseSignature=Validate an SSO response signature @@ -89,3 +91,12 @@ keycloak-saml.IDP.Key=Key definition for identity provider keycloak-saml.IDP.AllowedClockSkew=Allowed clock skew between the IDP and the SP keycloak-saml.IDP.AllowedClockSkew.value=Allowed clock skew value between the IDP and the SP keycloak-saml.IDP.AllowedClockSkew.unit=Time unit for the value of the clock skew. Values: MINUTES, SECONDS, MILLISECONDS, MICROSECONDS, NANOSECONDS +keycloak-saml.IDP.HttpClient=Configuration of HTTP client used for automatic retrieval of certificates for signature validation +keycloak-saml.IDP.HttpClient.allowAnyHostname=Define if hostname validation should be disabled (true) or not (false) +keycloak-saml.IDP.HttpClient.clientKeystore=Path to the keystore that contains client certificates for two-way SSL +keycloak-saml.IDP.HttpClient.clientKeystorePassword=The keystore password +keycloak-saml.IDP.HttpClient.connectionPoolSize=The number of pooled connections +keycloak-saml.IDP.HttpClient.disableTrustManager=Define if SSL certificate validation should be disabled (true) or not (false) +keycloak-saml.IDP.HttpClient.proxyUrl=URL to the HTTP proxy, if applicable +keycloak-saml.IDP.HttpClient.truststore=Path to the truststore used to validate the IDP certificates +keycloak-saml.IDP.HttpClient.truststorePassword=The truststore password \ No newline at end of file diff --git a/adapters/saml/as7-eap6/subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_3.xsd b/adapters/saml/as7-eap6/subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_3.xsd new file mode 100755 index 0000000000..48562b66b6 --- /dev/null +++ b/adapters/saml/as7-eap6/subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_3.xsd @@ -0,0 +1,570 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + The name of the deployment + + + + + + + + + + List of service provider encryption and validation keys. + + If the IDP requires that the client application (SP) sign all of its requests and/or if the IDP will encrypt assertions, you must define the keys used to do this. For client signed documents you must define both the private and public key or certificate that will be used to sign documents. For encryption, you only have to define the private key that will be used to decrypt. + + + + + When creating a Java Principal object that you obtain from methods like HttpServletRequest.getUserPrincipal(), you can define what name that is returned by the Principal.getName() method. + + + + + Defines what SAML attributes within the assertion received from the user should be used as role identifiers within the Java EE Security Context for the user. + By default Role attribute values are converted to Java EE roles. Some IDPs send roles via a member or memberOf attribute assertion. You can define one or more Attribute elements to specify which SAML attributes must be converted into roles. + + + + + Specifies the role mappings provider implementation that will be used to map the roles extracted from the SAML assertion into the final set of roles + that will be assigned to the principal. A provider is typically used to map roles retrieved from third party IDPs into roles that exist in the JEE application environment. It can also + assign extra roles to the assertion principal (for example, by connecting to an LDAP server to obtain more roles) or remove some of the roles that were set by the IDP. + + + + + Describes configuration of SAML identity provider for this service provider. + + + + + + This is the identifier for this client. The IDP needs this value to determine who the client is that is communicating with it. + + + + + SSL policy the adapter will enforce. + + + + + SAML clients can request a specific NameID Subject format. Fill in this value if you want a specific format. It must be a standard SAML format identifier, i.e. urn:oasis:names:tc:SAML:2.0:nameid-format:transient. By default, no special format is requested. + + + + + URL of the logout page. + + + + + SAML clients can request that a user is re-authenticated even if they are already logged in at the IDP. Default value is false. + + + + + Attribute to inject the DOM representation of the assertion into the SamlPrincipal (respecting the original syntax). Default value is false + + + + + SAML clients can request that a user is never asked to authenticate even if they are not logged in at the IDP. Set this to true if you want this. Do not use together with forceAuthentication as they are opposite. Default value is false. + + + + + The session id is changed by default on a successful login on some platforms to plug a security attack vector. Change this to true to disable this. It is recommended you do not turn it off. Default value is false. + + + + + This should be set to true if your application serves both a web application and web services (e.g. SOAP or REST). It allows you to redirect unauthenticated users of the web application to the Keycloak login page, but send an HTTP 401 status code to unauthenticated SOAP or REST clients instead as they would not understand a redirect to the login page. Keycloak auto-detects SOAP or REST clients based on typical headers like X-Requested-With, SOAPAction or Accept. The default value is false. + + + + + + + + + Describes a single key used for signing or encryption. + + + + + + + + + + Java keystore to load keys and certificates from. + + + + + Private key (PEM format) + + + + + Public key (PEM format) + + + + + Certificate key (PEM format) + + + + + + Flag defining whether the key should be used for signing. + + + + + Flag defining whether the key should be used for encryption + + + + + + + + + Private key declaration + + + + + Certificate declaration + + + + + + File path to the key store. + + + + + WAR resource path to the key store. This is a path used in method call to ServletContext.getResourceAsStream(). + + + + + The password of the key store. + + + + + Key store format + + + + + Key alias + + + + + + + + Alias that points to the key or cert within the keystore. + + + + + Keystores require an additional password to access private keys. In the PrivateKey element you must define this password within a password attribute. + + + + + + + + Alias that points to the key or cert within the keystore. + + + + + + + + Policy used to populate value of Java Principal object obtained from methods like HttpServletRequest.getUserPrincipal(). + + + + + Name of the SAML assertion attribute to use within. + + + + + + + + + This policy just uses whatever the SAML subject value is. This is the default setting + + + + + This will pull the value from one of the attributes declared in the SAML assertion received from the server. You'll need to specify the name of the SAML assertion attribute to use within the attribute XML attribute. + + + + + + + + + + All requests must come in via HTTPS. + + + + + Only non-private IP addresses must come over the wire via HTTPS. + + + + + no requests are required to come over via HTTPS. + + + + + + + + + + + + + + + + + + + + + + + + + + Specifies SAML attribute to be converted into roles. + + + + + + + + + Specifies name of the SAML attribute to be converted into roles. + + + + + + + + + Specifies a configuration property for the provider. + + + + + + The id of the role mappings provider that is to be used. Example: properties-based-provider. + + + + + + + + The name (key) of the configuration property. + + + + + The value of the configuration property. + + + + + + + + + Configuration of the login SAML endpoint of the IDP. + + + + + Configuration of the logout SAML endpoint of the IDP + + + + + The Keys sub element of IDP is only used to define the certificate or public key to use to verify documents signed by the IDP. + + + + + Configuration of HTTP client used for automatic obtaining of certificates containing public keys for IDP signature verification via SAML descriptor of the IDP. + + + + + This defines the allowed clock skew between IDP and SP in milliseconds. The default value is 0. + + + + + + issuer ID of the IDP. + + + + + If set to true, the client adapter will sign every document it sends to the IDP. Also, the client will expect that the IDP will be signing any documents sent to it. This switch sets the default for all request and response types. + + + + + Signature algorithm that the IDP expects signed documents to use. Defaults to RSA_SHA256 + + + + + This is the signature canonicalization method that the IDP expects signed documents to use. The default value is https://www.w3.org/2001/10/xml-exc-c14n# and should be good for most IDPs. + + + + + + + + + + The URL used to retrieve the IDP metadata, currently this is only used to pick up signing and encryption keys periodically which allow cycling of these keys on the IDP without manual changes on the SP side. + + + + + + + + Should the client sign authn requests? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client expect the IDP to sign the assertion response document sent back from an auhtn request? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client expect the IDP to sign the individual assertions sent back from an auhtn request? Defaults to whatever the IDP signaturesRequired element value is. + + + + + SAML binding type used for communicating with the IDP. The default value is POST, but you can set it to REDIRECT as well. + + + + + SAML allows the client to request what binding type it wants authn responses to use. This value maps to ProtocolBinding attribute in SAML AuthnRequest. The default is that the client will not request a specific binding type for responses. + + + + + This is the URL for the IDP login service that the client will send requests to. + + + + + URL of the assertion consumer service (ACS) where the IDP login service should send responses to. By default it is unset, relying on the IdP settings. When set, it must end in "/saml". This property is typically accompanied by the responseBinding attribute. + + + + + + + + Should the client sign authn requests? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client sign logout responses it sends to the IDP requests? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client expect signed logout request documents from the IDP? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client expect signed logout response documents from the IDP? Defaults to whatever the IDP signaturesRequired element value is. + + + + + This is the SAML binding type used for communicating SAML requests to the IDP. The default value is POST. + + + + + This is the SAML binding type used for communicating SAML responses to the IDP. The default value is POST. + + + + + This is the URL for the IDP's logout service when using the POST binding. This setting is REQUIRED if using the POST binding. + + + + + This is the URL for the IDP's logout service when using the REDIRECT binding. This setting is REQUIRED if using the REDIRECT binding. + + + + + + + + If the the IDP server requires HTTPS and this config option is set to true the IDP's certificate + is validated via the truststore, but host name validation is not done. This setting should only be used during + development and never in production as it will partly disable verification of SSL certificates. + This seting may be useful in test environments. The default value is false. + + + + + This is the file path to a keystore file. This keystore contains client certificate + for two-way SSL when the adapter makes HTTPS requests to the IDP server. + + + + + Password for the client keystore and for the client's key. + + + + + Defines number of pooled connections. + + + + + If the the IDP server requires HTTPS and this config option is set to true you do not have to specify a truststore. + This setting should only be used during development and never in production as it will disable verification of SSL certificates. + The default value is false. + + + + + URL to HTTP proxy to use for HTTP connections. + + + + + The value is the file path to a keystore file. If you prefix the path with classpath:, + then the truststore will be obtained from the deployment's classpath instead. Used for outgoing + HTTPS communications to the IDP server. Client making HTTPS requests need + a way to verify the host of the server they are talking to. This is what the trustore does. + The keystore contains one or more trusted host certificates or certificate authorities. + You can create this truststore by extracting the public certificate of the IDP's SSL keystore. + + + + + + Password for the truststore keystore. + + + + + + + The value is the allowed clock skew between the IDP and the SP. + + + + + + + + + + Time unit for the value of the clock skew. + + + + + + + + + + + diff --git a/adapters/saml/as7-eap6/subsystem/src/test/java/org/keycloak/subsystem/saml/as7/SubsystemParsingAllowedClockSkewTestCase.java b/adapters/saml/as7-eap6/subsystem/src/test/java/org/keycloak/subsystem/saml/as7/SubsystemParsingAllowedClockSkewTestCase.java index 068a2f5b2b..72ed0d6f7c 100755 --- a/adapters/saml/as7-eap6/subsystem/src/test/java/org/keycloak/subsystem/saml/as7/SubsystemParsingAllowedClockSkewTestCase.java +++ b/adapters/saml/as7-eap6/subsystem/src/test/java/org/keycloak/subsystem/saml/as7/SubsystemParsingAllowedClockSkewTestCase.java @@ -76,7 +76,7 @@ public class SubsystemParsingAllowedClockSkewTestCase extends AbstractSubsystemB private void setSubsystemXml(String value, String unit) throws IOException { try { - String template = readResource("keycloak-saml-1.2.xml"); + String template = readResource("keycloak-saml-1.3.xml"); if (value != null) { // assign the AllowedClockSkew element using DOM DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); diff --git a/adapters/saml/as7-eap6/subsystem/src/test/java/org/keycloak/subsystem/saml/as7/SubsystemParsingTestCase.java b/adapters/saml/as7-eap6/subsystem/src/test/java/org/keycloak/subsystem/saml/as7/SubsystemParsingTestCase.java index ff27f5ad56..fd871b906a 100755 --- a/adapters/saml/as7-eap6/subsystem/src/test/java/org/keycloak/subsystem/saml/as7/SubsystemParsingTestCase.java +++ b/adapters/saml/as7-eap6/subsystem/src/test/java/org/keycloak/subsystem/saml/as7/SubsystemParsingTestCase.java @@ -34,6 +34,6 @@ public class SubsystemParsingTestCase extends AbstractSubsystemBaseTest { @Override protected String getSubsystemXml() throws IOException { - return readResource("keycloak-saml-1.2.xml"); + return readResource("keycloak-saml-1.3.xml"); } } diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.2.xml b/adapters/saml/as7-eap6/subsystem/src/test/resources/org/keycloak/subsystem/saml/as7/keycloak-saml-1.3.xml similarity index 79% rename from adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.2.xml rename to adapters/saml/as7-eap6/subsystem/src/test/resources/org/keycloak/subsystem/saml/as7/keycloak-saml-1.3.xml index bb0fc98985..9a34e726fe 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.2.xml +++ b/adapters/saml/as7-eap6/subsystem/src/test/resources/org/keycloak/subsystem/saml/as7/keycloak-saml-1.3.xml @@ -1,5 +1,5 @@ - + + turnOffChangeSessionIdOnLogin="true" + autodetectBearerOnly="false"> @@ -46,7 +47,11 @@ - + + diff --git a/adapters/saml/core/src/main/resources/schema/keycloak_saml_adapter_1_12.xsd b/adapters/saml/core/src/main/resources/schema/keycloak_saml_adapter_1_12.xsd index 8f682e9d81..1b1245d52d 100644 --- a/adapters/saml/core/src/main/resources/schema/keycloak_saml_adapter_1_12.xsd +++ b/adapters/saml/core/src/main/resources/schema/keycloak_saml_adapter_1_12.xsd @@ -190,6 +190,16 @@ The password of the key store. + + + Key store format + + + + + Key alias + + diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/Constants.java b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/Constants.java index b32133c024..9d22fd9a80 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/Constants.java +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/Constants.java @@ -33,6 +33,7 @@ public class Constants { static final String KEEP_DOM_ASSERTION = "keepDOMAssertion"; static final String IS_PASSIVE = "isPassive"; static final String TURN_OFF_CHANGE_SESSSION_ID_ON_LOGIN = "turnOffChangeSessionIdOnLogin"; + static final String AUTODETECT_BEARER_ONLY = "autodetectBearerOnly"; static final String ROLE_ATTRIBUTES = "RoleIdentifiers"; static final String SIGNING = "signing"; static final String ENCRYPTION = "encryption"; @@ -64,6 +65,7 @@ public class Constants { static final String PRINCIPAL_NAME_MAPPING_ATTRIBUTE_NAME = "PrincipalNameMapping-attribute-name"; static final String SIGNATURE_ALGORITHM = "signatureAlgorithm"; static final String SIGNATURE_CANONICALIZATION_METHOD = "signatureCanonicalizationMethod"; + static final String METADATA_URL = "metadataUrl"; static final String PRIVATE_KEY_PEM = "PrivateKeyPem"; static final String PUBLIC_KEY_PEM = "PublicKeyPem"; static final String CERTIFICATE_PEM = "CertificatePem"; @@ -72,14 +74,26 @@ public class Constants { static final String FILE = "file"; static final String SIGNATURES_REQUIRED = "signaturesRequired"; + // role mappings provider constants static final String ROLE_MAPPINGS_PROVIDER_ID = "roleMappingsProviderId"; static final String ROLE_MAPPINGS_PROVIDER_CONFIG = "roleMappingsProviderConfig"; + // allowed clock skew model constants static final String ALLOWED_CLOCK_SKEW = "AllowedClockSkew"; static final String ALLOWED_CLOCK_SKEW_UNIT = "unit"; static final String ALLOWED_CLOCK_SKEW_VALUE = "value"; - } + // http client model constants + static final String HTTP_CLIENT = "HttpClient"; + static final String ALLOW_ANY_HOSTNAME = "allowAnyHostname"; + static final String CLIENT_KEYSTORE = "clientKeystore"; + static final String CLIENT_KEYSTORE_PASSWORD = "clientKeystorePassword"; + static final String CONNECTION_POOL_SIZE = "connectionPoolSize"; + static final String DISABLE_TRUST_MANAGER = "disableTrustManager"; + static final String PROXY_URL = "proxyUrl"; + static final String TRUSTSTORE = "truststore"; + static final String TRUSTSTORE_PASSWORD = "truststorePassword"; + } static class XML { static final String SECURE_DEPLOYMENT = "secure-deployment"; @@ -104,6 +118,7 @@ public class Constants { static final String CERTIFICATE = "Certificate"; static final String IS_PASSIVE = "isPassive"; static final String TURN_OFF_CHANGE_SESSSION_ID_ON_LOGIN = "turnOffChangeSessionIdOnLogin"; + static final String AUTODETECT_BEARER_ONLY = "autodetectBearerOnly"; static final String PRIVATE_KEY_ALIAS = "alias"; static final String PRIVATE_KEY_PASSWORD = "password"; @@ -127,6 +142,7 @@ public class Constants { static final String ATTRIBUTE = "Attribute"; static final String SIGNATURE_ALGORITHM = "signatureAlgorithm"; static final String SIGNATURE_CANONICALIZATION_METHOD = "signatureCanonicalizationMethod"; + static final String METADATA_URL = "metadataUrl"; static final String PRIVATE_KEY_PEM = "PrivateKeyPem"; static final String PUBLIC_KEY_PEM = "PublicKeyPem"; static final String CERTIFICATE_PEM = "CertificatePem"; @@ -136,13 +152,26 @@ public class Constants { static final String SIGNATURES_REQUIRED = "signaturesRequired"; static final String ASSERTION_CONSUMER_SERVICE_URL = "assertionConsumerServiceUrl"; + // role mappings provider XML constants static final String ID = "id"; static final String VALUE = "value"; static final String PROPERTY = "Property"; static final String ROLE_MAPPINGS_PROVIDER = "RoleMappingsProvider"; + // allowed clock skew XML constants static final String ALLOWED_CLOCK_SKEW = "AllowedClockSkew"; static final String ALLOWED_CLOCK_SKEW_UNIT = "unit"; + + // http client XML constants + static final String HTTP_CLIENT = "HttpClient"; + static final String ALLOW_ANY_HOSTNAME = "allowAnyHostname"; + static final String CLIENT_KEYSTORE = "clientKeystore"; + static final String CLIENT_KEYSTORE_PASSWORD = "clientKeystorePassword"; + static final String CONNECTION_POOL_SIZE = "connectionPoolSize"; + static final String DISABLE_TRUST_MANAGER = "disableTrustManager"; + static final String PROXY_URL = "proxyUrl"; + static final String TRUSTSTORE = "truststore"; + static final String TRUSTSTORE_PASSWORD = "truststorePassword"; } } diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/HttpClientDefinition.java b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/HttpClientDefinition.java new file mode 100644 index 0000000000..db83b73d9c --- /dev/null +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/HttpClientDefinition.java @@ -0,0 +1,95 @@ +/* + * Copyright 2020 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.keycloak.subsystem.adapter.saml.extension; + +import java.util.HashMap; + +import org.jboss.as.controller.SimpleAttributeDefinition; +import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; +import org.jboss.dmr.ModelType; + +/** + * This class contains the definitions for the {@code HttpClient} attributes, as specified in the schema's {@code http-client-type} + * complex type. + * + * @author Stefan Guilhen + */ +abstract class HttpClientDefinition { + + private static final SimpleAttributeDefinition ALLOW_ANY_HOSTNAME = + new SimpleAttributeDefinitionBuilder(Constants.Model.ALLOW_ANY_HOSTNAME, ModelType.BOOLEAN, true) + .setXmlName(Constants.XML.ALLOW_ANY_HOSTNAME) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition CLIENT_KEYSTORE = + new SimpleAttributeDefinitionBuilder(Constants.Model.CLIENT_KEYSTORE, ModelType.STRING, true) + .setXmlName(Constants.XML.CLIENT_KEYSTORE) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition CLIENT_KEYSTORE_PASSWORD = + new SimpleAttributeDefinitionBuilder(Constants.Model.CLIENT_KEYSTORE_PASSWORD, ModelType.STRING, true) + .setXmlName(Constants.XML.CLIENT_KEYSTORE_PASSWORD) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition CONNECTION_POOL_SIZE = + new SimpleAttributeDefinitionBuilder(Constants.Model.CONNECTION_POOL_SIZE, ModelType.INT, true) + .setXmlName(Constants.XML.CONNECTION_POOL_SIZE) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition DISABLE_TRUST_MANAGER = + new SimpleAttributeDefinitionBuilder(Constants.Model.DISABLE_TRUST_MANAGER, ModelType.BOOLEAN, true) + .setXmlName(Constants.XML.DISABLE_TRUST_MANAGER) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition PROXY_URL = + new SimpleAttributeDefinitionBuilder(Constants.Model.PROXY_URL, ModelType.STRING, true) + .setXmlName(Constants.XML.PROXY_URL) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition TRUSTSTORE = + new SimpleAttributeDefinitionBuilder(Constants.Model.TRUSTSTORE, ModelType.STRING, true) + .setXmlName(Constants.XML.TRUSTSTORE) + .setAllowExpression(true) + .build(); + + private static final SimpleAttributeDefinition TRUSTSTORE_PASSWORD = + new SimpleAttributeDefinitionBuilder(Constants.Model.TRUSTSTORE_PASSWORD, ModelType.STRING, true) + .setXmlName(Constants.XML.TRUSTSTORE_PASSWORD) + .setAllowExpression(true) + .build(); + + static final SimpleAttributeDefinition[] ATTRIBUTES = {ALLOW_ANY_HOSTNAME, CLIENT_KEYSTORE, CLIENT_KEYSTORE_PASSWORD, + CONNECTION_POOL_SIZE, DISABLE_TRUST_MANAGER, PROXY_URL, TRUSTSTORE, TRUSTSTORE_PASSWORD}; + + private static final HashMap ATTRIBUTE_MAP = new HashMap<>(); + + static { + for (SimpleAttributeDefinition def : ATTRIBUTES) { + ATTRIBUTE_MAP.put(def.getXmlName(), def); + } + } + + static SimpleAttributeDefinition lookup(String xmlName) { + return ATTRIBUTE_MAP.get(xmlName); + } +} diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/IdentityProviderDefinition.java b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/IdentityProviderDefinition.java index 2766f33ff2..3b609169e2 100644 --- a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/IdentityProviderDefinition.java +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/IdentityProviderDefinition.java @@ -36,44 +36,57 @@ import java.util.HashMap; */ public class IdentityProviderDefinition extends SimpleResourceDefinition { - static final SimpleAttributeDefinition SIGNATURES_REQUIRED = + private static final SimpleAttributeDefinition SIGNATURES_REQUIRED = new SimpleAttributeDefinitionBuilder(Constants.Model.SIGNATURES_REQUIRED, ModelType.BOOLEAN, true) .setXmlName(Constants.XML.SIGNATURES_REQUIRED) .build(); - static final SimpleAttributeDefinition SIGNATURE_ALGORITHM = + private static final SimpleAttributeDefinition SIGNATURE_ALGORITHM = new SimpleAttributeDefinitionBuilder(Constants.Model.SIGNATURE_ALGORITHM, ModelType.STRING, true) .setXmlName(Constants.XML.SIGNATURE_ALGORITHM) .build(); - static final SimpleAttributeDefinition SIGNATURE_CANONICALIZATION_METHOD = + private static final SimpleAttributeDefinition SIGNATURE_CANONICALIZATION_METHOD = new SimpleAttributeDefinitionBuilder(Constants.Model.SIGNATURE_CANONICALIZATION_METHOD, ModelType.STRING, true) .setXmlName(Constants.XML.SIGNATURE_CANONICALIZATION_METHOD) .build(); - static final ObjectTypeAttributeDefinition SINGLE_SIGN_ON = + private static final SimpleAttributeDefinition METADATA_URL = + new SimpleAttributeDefinitionBuilder(Constants.Model.METADATA_URL, ModelType.STRING, true) + .setXmlName(Constants.XML.METADATA_URL) + .setAllowExpression(true) + .build(); + + private static final ObjectTypeAttributeDefinition SINGLE_SIGN_ON = ObjectTypeAttributeDefinition.Builder.of(Constants.Model.SINGLE_SIGN_ON, SingleSignOnDefinition.ATTRIBUTES) .setAllowNull(false) .build(); - static final ObjectTypeAttributeDefinition SINGLE_LOGOUT = + private static final ObjectTypeAttributeDefinition SINGLE_LOGOUT = ObjectTypeAttributeDefinition.Builder.of(Constants.Model.SINGLE_LOGOUT, SingleLogoutDefinition.ATTRIBUTES) .setAllowNull(false) .build(); - static final ObjectTypeAttributeDefinition ALLOWED_CLOCK_SKEW = + private static final ObjectTypeAttributeDefinition ALLOWED_CLOCK_SKEW = ObjectTypeAttributeDefinition.Builder.of(Constants.Model.ALLOWED_CLOCK_SKEW, AllowedClockSkew.ATTRIBUTES) .setAllowNull(true) .build(); - static final SimpleAttributeDefinition[] ATTRIBUTES = {SIGNATURES_REQUIRED, SIGNATURE_ALGORITHM, SIGNATURE_CANONICALIZATION_METHOD}; + private static final ObjectTypeAttributeDefinition HTTP_CLIENT = + ObjectTypeAttributeDefinition.Builder.of(Constants.Model.HTTP_CLIENT, + HttpClientDefinition.ATTRIBUTES) + .setAllowNull(true) + .build(); - static final SimpleAttributeDefinition[] ALL_ATTRIBUTES = {SIGNATURES_REQUIRED, SIGNATURE_ALGORITHM, SIGNATURE_CANONICALIZATION_METHOD, SINGLE_SIGN_ON, SINGLE_LOGOUT, ALLOWED_CLOCK_SKEW}; + static final SimpleAttributeDefinition[] ATTRIBUTES = {SIGNATURES_REQUIRED, SIGNATURE_ALGORITHM, SIGNATURE_CANONICALIZATION_METHOD, METADATA_URL}; - static final HashMap ATTRIBUTE_MAP = new HashMap<>(); + static final SimpleAttributeDefinition[] ALL_ATTRIBUTES = {SIGNATURES_REQUIRED, SIGNATURE_ALGORITHM, SIGNATURE_CANONICALIZATION_METHOD, METADATA_URL, + SINGLE_SIGN_ON, SINGLE_LOGOUT, ALLOWED_CLOCK_SKEW, HTTP_CLIENT}; + + private static final HashMap ATTRIBUTE_MAP = new HashMap<>(); static { for (SimpleAttributeDefinition def : ALL_ATTRIBUTES) { diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSamlExtension.java b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSamlExtension.java index dfa43bd213..ef70a945ec 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSamlExtension.java +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSamlExtension.java @@ -35,17 +35,19 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUB */ public class KeycloakSamlExtension implements Extension { - public static final String SUBSYSTEM_NAME = "keycloak-saml"; - public static final String NAMESPACE_1_1 = "urn:jboss:domain:keycloak-saml:1.1"; - public static final String NAMESPACE_1_2 = "urn:jboss:domain:keycloak-saml:1.2"; - public static final String CURRENT_NAMESPACE = NAMESPACE_1_2; + static final String SUBSYSTEM_NAME = "keycloak-saml"; + private static final String NAMESPACE_1_1 = "urn:jboss:domain:keycloak-saml:1.1"; + private static final String NAMESPACE_1_2 = "urn:jboss:domain:keycloak-saml:1.2"; + private static final String NAMESPACE_1_3 = "urn:jboss:domain:keycloak-saml:1.3"; + + static final String CURRENT_NAMESPACE = NAMESPACE_1_3; private static final KeycloakSubsystemParser PARSER = new KeycloakSubsystemParser(); static final PathElement PATH_SUBSYSTEM = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME); private static final String RESOURCE_NAME = KeycloakSamlExtension.class.getPackage().getName() + ".LocalDescriptions"; private static final ModelVersion MGMT_API_VERSION = ModelVersion.create(1, 1, 0); static final PathElement SUBSYSTEM_PATH = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME); - public static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { + static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME); for (String kp : keyPrefix) { prefix.append('.').append(kp); @@ -60,6 +62,7 @@ public class KeycloakSamlExtension implements Extension { public void initializeParsers(final ExtensionParsingContext context) { context.setSubsystemXmlMapping(SUBSYSTEM_NAME, KeycloakSamlExtension.NAMESPACE_1_1, PARSER); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, KeycloakSamlExtension.NAMESPACE_1_2, PARSER); + context.setSubsystemXmlMapping(SUBSYSTEM_NAME, KeycloakSamlExtension.NAMESPACE_1_3, PARSER); } /** diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java index 25aae2ce3a..a82e81fee1 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java @@ -159,6 +159,8 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader
  • ATTRIBUTE_MAP = new HashMap<>(); - static final HashMap ALL_MAP = new HashMap<>(); + private static final HashMap ATTRIBUTE_MAP = new HashMap<>(); + private static final HashMap ALL_MAP = new HashMap<>(); static final Collection ALL_ATTRIBUTES; static { diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/org/keycloak/subsystem/adapter/saml/extension/LocalDescriptions.properties b/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/org/keycloak/subsystem/adapter/saml/extension/LocalDescriptions.properties index cc8e355305..0ad519f942 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/org/keycloak/subsystem/adapter/saml/extension/LocalDescriptions.properties +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/org/keycloak/subsystem/adapter/saml/extension/LocalDescriptions.properties @@ -35,6 +35,7 @@ keycloak-saml.SP.forceAuthentication=Redirected unauthenticated request to a log keycloak-saml.SP.keepDOMAssertion=Attribute to inject the DOM representation of the assertion into the SamlPrincipal (respecting the original syntax) keycloak-saml.SP.isPassive=If user isn't logged in just return with an error. Used to check if a user is already logged in or not keycloak-saml.SP.turnOffChangeSessionIdOnLogin=The session id is changed by default on a successful login. Change this to true if you want to turn this off +keycloak-saml.SP.autodetectBearerOnly=Set to true if the application serves both a web application and web services (e.g. SOAP or REST). It allows redirection of unauthenticated users of the web application to the Keycloak login page, but send an HTTP 401 status code to unauthenticated SOAP or REST clients instead keycloak-saml.SP.RoleIdentifiers=Role identifiers keycloak-saml.SP.PrincipalNameMapping-policy=Principal name mapping policy keycloak-saml.SP.PrincipalNameMapping-attribute-name=Principal name mapping attribute name @@ -67,6 +68,7 @@ keycloak-saml.IDP.remove=Remove an identity provider keycloak-saml.IDP.signaturesRequired=Require signatures for SingleSignOnService and SingleLogoutService keycloak-saml.IDP.signatureAlgorithm=Signature algorithm keycloak-saml.IDP.signatureCanonicalizationMethod=Signature canonicalization method +keycloak-saml.IDP.metadataUrl=The URL used to retrieve the IDP metadata from keycloak-saml.IDP.SingleSignOnService=Single sign-on configuration keycloak-saml.IDP.SingleSignOnService.signRequest=Sign SSO requests keycloak-saml.IDP.SingleSignOnService.validateResponseSignature=Validate an SSO response signature @@ -88,3 +90,12 @@ keycloak-saml.IDP.Key=Key definition for identity provider keycloak-saml.IDP.AllowedClockSkew=Allowed clock skew between the IDP and the SP keycloak-saml.IDP.AllowedClockSkew.value=Allowed clock skew value between the IDP and the SP keycloak-saml.IDP.AllowedClockSkew.unit=Time unit for the value of the clock skew. Values: MINUTES, SECONDS, MILLISECONDS, MICROSECONDS, NANOSECONDS +keycloak-saml.IDP.HttpClient=Configuration of HTTP client used for automatic retrieval of certificates for signature validation +keycloak-saml.IDP.HttpClient.allowAnyHostname=Define if hostname validation should be disabled (true) or not (false) +keycloak-saml.IDP.HttpClient.clientKeystore=Path to the keystore that contains client certificates for two-way SSL +keycloak-saml.IDP.HttpClient.clientKeystorePassword=The keystore password +keycloak-saml.IDP.HttpClient.connectionPoolSize=The number of pooled connections +keycloak-saml.IDP.HttpClient.disableTrustManager=Define if SSL certificate validation should be disabled (true) or not (false) +keycloak-saml.IDP.HttpClient.proxyUrl=URL to the HTTP proxy, if applicable +keycloak-saml.IDP.HttpClient.truststore=Path to the truststore used to validate the IDP certificates +keycloak-saml.IDP.HttpClient.truststorePassword=The truststore password \ No newline at end of file diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_3.xsd b/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_3.xsd new file mode 100755 index 0000000000..48562b66b6 --- /dev/null +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_3.xsd @@ -0,0 +1,570 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + The name of the deployment + + + + + + + + + + List of service provider encryption and validation keys. + + If the IDP requires that the client application (SP) sign all of its requests and/or if the IDP will encrypt assertions, you must define the keys used to do this. For client signed documents you must define both the private and public key or certificate that will be used to sign documents. For encryption, you only have to define the private key that will be used to decrypt. + + + + + When creating a Java Principal object that you obtain from methods like HttpServletRequest.getUserPrincipal(), you can define what name that is returned by the Principal.getName() method. + + + + + Defines what SAML attributes within the assertion received from the user should be used as role identifiers within the Java EE Security Context for the user. + By default Role attribute values are converted to Java EE roles. Some IDPs send roles via a member or memberOf attribute assertion. You can define one or more Attribute elements to specify which SAML attributes must be converted into roles. + + + + + Specifies the role mappings provider implementation that will be used to map the roles extracted from the SAML assertion into the final set of roles + that will be assigned to the principal. A provider is typically used to map roles retrieved from third party IDPs into roles that exist in the JEE application environment. It can also + assign extra roles to the assertion principal (for example, by connecting to an LDAP server to obtain more roles) or remove some of the roles that were set by the IDP. + + + + + Describes configuration of SAML identity provider for this service provider. + + + + + + This is the identifier for this client. The IDP needs this value to determine who the client is that is communicating with it. + + + + + SSL policy the adapter will enforce. + + + + + SAML clients can request a specific NameID Subject format. Fill in this value if you want a specific format. It must be a standard SAML format identifier, i.e. urn:oasis:names:tc:SAML:2.0:nameid-format:transient. By default, no special format is requested. + + + + + URL of the logout page. + + + + + SAML clients can request that a user is re-authenticated even if they are already logged in at the IDP. Default value is false. + + + + + Attribute to inject the DOM representation of the assertion into the SamlPrincipal (respecting the original syntax). Default value is false + + + + + SAML clients can request that a user is never asked to authenticate even if they are not logged in at the IDP. Set this to true if you want this. Do not use together with forceAuthentication as they are opposite. Default value is false. + + + + + The session id is changed by default on a successful login on some platforms to plug a security attack vector. Change this to true to disable this. It is recommended you do not turn it off. Default value is false. + + + + + This should be set to true if your application serves both a web application and web services (e.g. SOAP or REST). It allows you to redirect unauthenticated users of the web application to the Keycloak login page, but send an HTTP 401 status code to unauthenticated SOAP or REST clients instead as they would not understand a redirect to the login page. Keycloak auto-detects SOAP or REST clients based on typical headers like X-Requested-With, SOAPAction or Accept. The default value is false. + + + + + + + + + Describes a single key used for signing or encryption. + + + + + + + + + + Java keystore to load keys and certificates from. + + + + + Private key (PEM format) + + + + + Public key (PEM format) + + + + + Certificate key (PEM format) + + + + + + Flag defining whether the key should be used for signing. + + + + + Flag defining whether the key should be used for encryption + + + + + + + + + Private key declaration + + + + + Certificate declaration + + + + + + File path to the key store. + + + + + WAR resource path to the key store. This is a path used in method call to ServletContext.getResourceAsStream(). + + + + + The password of the key store. + + + + + Key store format + + + + + Key alias + + + + + + + + Alias that points to the key or cert within the keystore. + + + + + Keystores require an additional password to access private keys. In the PrivateKey element you must define this password within a password attribute. + + + + + + + + Alias that points to the key or cert within the keystore. + + + + + + + + Policy used to populate value of Java Principal object obtained from methods like HttpServletRequest.getUserPrincipal(). + + + + + Name of the SAML assertion attribute to use within. + + + + + + + + + This policy just uses whatever the SAML subject value is. This is the default setting + + + + + This will pull the value from one of the attributes declared in the SAML assertion received from the server. You'll need to specify the name of the SAML assertion attribute to use within the attribute XML attribute. + + + + + + + + + + All requests must come in via HTTPS. + + + + + Only non-private IP addresses must come over the wire via HTTPS. + + + + + no requests are required to come over via HTTPS. + + + + + + + + + + + + + + + + + + + + + + + + + + Specifies SAML attribute to be converted into roles. + + + + + + + + + Specifies name of the SAML attribute to be converted into roles. + + + + + + + + + Specifies a configuration property for the provider. + + + + + + The id of the role mappings provider that is to be used. Example: properties-based-provider. + + + + + + + + The name (key) of the configuration property. + + + + + The value of the configuration property. + + + + + + + + + Configuration of the login SAML endpoint of the IDP. + + + + + Configuration of the logout SAML endpoint of the IDP + + + + + The Keys sub element of IDP is only used to define the certificate or public key to use to verify documents signed by the IDP. + + + + + Configuration of HTTP client used for automatic obtaining of certificates containing public keys for IDP signature verification via SAML descriptor of the IDP. + + + + + This defines the allowed clock skew between IDP and SP in milliseconds. The default value is 0. + + + + + + issuer ID of the IDP. + + + + + If set to true, the client adapter will sign every document it sends to the IDP. Also, the client will expect that the IDP will be signing any documents sent to it. This switch sets the default for all request and response types. + + + + + Signature algorithm that the IDP expects signed documents to use. Defaults to RSA_SHA256 + + + + + This is the signature canonicalization method that the IDP expects signed documents to use. The default value is https://www.w3.org/2001/10/xml-exc-c14n# and should be good for most IDPs. + + + + + + + + + + The URL used to retrieve the IDP metadata, currently this is only used to pick up signing and encryption keys periodically which allow cycling of these keys on the IDP without manual changes on the SP side. + + + + + + + + Should the client sign authn requests? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client expect the IDP to sign the assertion response document sent back from an auhtn request? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client expect the IDP to sign the individual assertions sent back from an auhtn request? Defaults to whatever the IDP signaturesRequired element value is. + + + + + SAML binding type used for communicating with the IDP. The default value is POST, but you can set it to REDIRECT as well. + + + + + SAML allows the client to request what binding type it wants authn responses to use. This value maps to ProtocolBinding attribute in SAML AuthnRequest. The default is that the client will not request a specific binding type for responses. + + + + + This is the URL for the IDP login service that the client will send requests to. + + + + + URL of the assertion consumer service (ACS) where the IDP login service should send responses to. By default it is unset, relying on the IdP settings. When set, it must end in "/saml". This property is typically accompanied by the responseBinding attribute. + + + + + + + + Should the client sign authn requests? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client sign logout responses it sends to the IDP requests? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client expect signed logout request documents from the IDP? Defaults to whatever the IDP signaturesRequired element value is. + + + + + Should the client expect signed logout response documents from the IDP? Defaults to whatever the IDP signaturesRequired element value is. + + + + + This is the SAML binding type used for communicating SAML requests to the IDP. The default value is POST. + + + + + This is the SAML binding type used for communicating SAML responses to the IDP. The default value is POST. + + + + + This is the URL for the IDP's logout service when using the POST binding. This setting is REQUIRED if using the POST binding. + + + + + This is the URL for the IDP's logout service when using the REDIRECT binding. This setting is REQUIRED if using the REDIRECT binding. + + + + + + + + If the the IDP server requires HTTPS and this config option is set to true the IDP's certificate + is validated via the truststore, but host name validation is not done. This setting should only be used during + development and never in production as it will partly disable verification of SSL certificates. + This seting may be useful in test environments. The default value is false. + + + + + This is the file path to a keystore file. This keystore contains client certificate + for two-way SSL when the adapter makes HTTPS requests to the IDP server. + + + + + Password for the client keystore and for the client's key. + + + + + Defines number of pooled connections. + + + + + If the the IDP server requires HTTPS and this config option is set to true you do not have to specify a truststore. + This setting should only be used during development and never in production as it will disable verification of SSL certificates. + The default value is false. + + + + + URL to HTTP proxy to use for HTTP connections. + + + + + The value is the file path to a keystore file. If you prefix the path with classpath:, + then the truststore will be obtained from the deployment's classpath instead. Used for outgoing + HTTPS communications to the IDP server. Client making HTTPS requests need + a way to verify the host of the server they are talking to. This is what the trustore does. + The keystore contains one or more trusted host certificates or certificate authorities. + You can create this truststore by extracting the public certificate of the IDP's SSL keystore. + + + + + + Password for the truststore keystore. + + + + + + + The value is the allowed clock skew between the IDP and the SP. + + + + + + + + + + Time unit for the value of the clock skew. + + + + + + + + + + + diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/subsystem-templates/keycloak-saml-adapter.xml b/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/subsystem-templates/keycloak-saml-adapter.xml index d05812d054..ef4534b8f1 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/subsystem-templates/keycloak-saml-adapter.xml +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/resources/subsystem-templates/keycloak-saml-adapter.xml @@ -19,6 +19,6 @@ org.keycloak.keycloak-saml-adapter-subsystem - + diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/saml/extension/SubsystemParsingAllowedClockSkewTestCase.java b/adapters/saml/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/saml/extension/SubsystemParsingAllowedClockSkewTestCase.java index d7e17c2de6..b3ccf4de7b 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/saml/extension/SubsystemParsingAllowedClockSkewTestCase.java +++ b/adapters/saml/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/saml/extension/SubsystemParsingAllowedClockSkewTestCase.java @@ -77,7 +77,7 @@ public class SubsystemParsingAllowedClockSkewTestCase extends AbstractSubsystemB @Override protected String getSubsystemXsdPath() throws Exception { - return "schema/wildfly-keycloak-saml_1_2.xsd"; + return "schema/wildfly-keycloak-saml_1_3.xsd"; } @Override @@ -94,7 +94,7 @@ public class SubsystemParsingAllowedClockSkewTestCase extends AbstractSubsystemB private void setSubsystemXml(String value, String unit) throws IOException { try { - String template = readResource("keycloak-saml-1.2.xml"); + String template = readResource("keycloak-saml-1.3.xml"); if (value != null) { // assign the AllowedClockSkew element using DOM DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/saml/extension/SubsystemParsingTestCase.java b/adapters/saml/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/saml/extension/SubsystemParsingTestCase.java index 620958608f..84b1c342d8 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/saml/extension/SubsystemParsingTestCase.java +++ b/adapters/saml/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/saml/extension/SubsystemParsingTestCase.java @@ -39,12 +39,12 @@ public class SubsystemParsingTestCase extends AbstractSubsystemBaseTest { @Override protected String getSubsystemXml() throws IOException { - return readResource("keycloak-saml-1.2.xml"); + return readResource("keycloak-saml-1.3.xml"); } @Override protected String getSubsystemXsdPath() throws Exception { - return "schema/wildfly-keycloak-saml_1_2.xsd"; + return "schema/wildfly-keycloak-saml_1_3.xsd"; } @Override diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.2-err.xml b/adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.2-err.xml deleted file mode 100644 index 6733125e55..0000000000 --- a/adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.2-err.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - my_key.pem - my_key.pub - cert.cer - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/adapters/saml/as7-eap6/subsystem/src/test/resources/org/keycloak/subsystem/saml/as7/keycloak-saml-1.2.xml b/adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.3.xml similarity index 79% rename from adapters/saml/as7-eap6/subsystem/src/test/resources/org/keycloak/subsystem/saml/as7/keycloak-saml-1.2.xml rename to adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.3.xml index e94c076247..9a34e726fe 100755 --- a/adapters/saml/as7-eap6/subsystem/src/test/resources/org/keycloak/subsystem/saml/as7/keycloak-saml-1.2.xml +++ b/adapters/saml/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/saml/extension/keycloak-saml-1.3.xml @@ -1,5 +1,5 @@ - + + turnOffChangeSessionIdOnLogin="true" + autodetectBearerOnly="false"> @@ -46,7 +47,11 @@ - + + - \ No newline at end of file +