diff --git a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/HttpClientBuilder.java b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/HttpClientBuilder.java index 42dfa1bf67..7270ae427e 100755 --- a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/HttpClientBuilder.java +++ b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/HttpClientBuilder.java @@ -384,6 +384,10 @@ public class HttpClientBuilder { establishConnectionTimeout(adapterConfig.getConnectionTimeout(), TimeUnit.MILLISECONDS); } + if (connectionTTL == -1 && adapterConfig.getConnectionTTL() > 0) { + connectionTTL(adapterConfig.getConnectionTTL(), TimeUnit.MILLISECONDS); + } + return build(); } diff --git a/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/KeycloakExtension.java b/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/KeycloakExtension.java index 79eeb11cb2..ec30337065 100755 --- a/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/KeycloakExtension.java +++ b/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/KeycloakExtension.java @@ -37,7 +37,7 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUB public class KeycloakExtension implements Extension { public static final String SUBSYSTEM_NAME = "keycloak"; - public static final String NAMESPACE = "urn:jboss:domain:keycloak:1.1"; + public static final String NAMESPACE = "urn:jboss:domain:keycloak:1.2"; private static final KeycloakSubsystemParser PARSER = new KeycloakSubsystemParser(); static final PathElement PATH_SUBSYSTEM = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME); private static final String RESOURCE_NAME = KeycloakExtension.class.getPackage().getName() + ".LocalDescriptions"; diff --git a/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/SharedAttributeDefinitons.java b/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/SharedAttributeDefinitons.java index 5b1fe4df4a..e4752b6ea4 100755 --- a/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/SharedAttributeDefinitons.java +++ b/adapters/oidc/as7-eap6/as7-subsystem/src/main/java/org/keycloak/subsystem/as7/SharedAttributeDefinitons.java @@ -19,6 +19,7 @@ package org.keycloak.subsystem.as7; import org.jboss.as.controller.SimpleAttributeDefinition; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.as.controller.operations.validation.IntRangeValidator; +import org.jboss.as.controller.operations.validation.LongRangeValidator; import org.jboss.as.controller.operations.validation.StringLengthValidator; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; @@ -81,6 +82,24 @@ class SharedAttributeDefinitons { .setAllowExpression(true) .setValidator(new IntRangeValidator(0, true)) .build(); + protected static final SimpleAttributeDefinition SOCKET_TIMEOUT = + new SimpleAttributeDefinitionBuilder("socket-timeout", ModelType.LONG, true) + .setXmlName("socket-timeout") + .setAllowExpression(true) + .setValidator(new LongRangeValidator(-1L, true)) + .build(); + protected static final SimpleAttributeDefinition CONNECTION_TTL = + new SimpleAttributeDefinitionBuilder("connection-ttl", ModelType.LONG, true) + .setXmlName("connection-ttl") + .setAllowExpression(true) + .setValidator(new LongRangeValidator(-1L, true)) + .build(); + protected static final SimpleAttributeDefinition CONNECTION_TIMEOUT = + new SimpleAttributeDefinitionBuilder("connection-timeout", ModelType.LONG, true) + .setXmlName("connection-timeout") + .setAllowExpression(true) + .setValidator(new LongRangeValidator(-1L, true)) + .build(); protected static final SimpleAttributeDefinition ENABLE_CORS = new SimpleAttributeDefinitionBuilder("enable-cors", ModelType.BOOLEAN, true) @@ -192,6 +211,9 @@ class SharedAttributeDefinitons { ATTRIBUTES.add(ALLOW_ANY_HOSTNAME); ATTRIBUTES.add(DISABLE_TRUST_MANAGER); ATTRIBUTES.add(CONNECTION_POOL_SIZE); + ATTRIBUTES.add(SOCKET_TIMEOUT); + ATTRIBUTES.add(CONNECTION_TTL); + ATTRIBUTES.add(CONNECTION_TIMEOUT); ATTRIBUTES.add(ENABLE_CORS); ATTRIBUTES.add(CLIENT_KEYSTORE); ATTRIBUTES.add(CLIENT_KEYSTORE_PASSWORD); diff --git a/adapters/oidc/as7-eap6/as7-subsystem/src/main/resources/org/keycloak/subsystem/as7/LocalDescriptions.properties b/adapters/oidc/as7-eap6/as7-subsystem/src/main/resources/org/keycloak/subsystem/as7/LocalDescriptions.properties index ca01ed36dc..3ef0a420c5 100755 --- a/adapters/oidc/as7-eap6/as7-subsystem/src/main/resources/org/keycloak/subsystem/as7/LocalDescriptions.properties +++ b/adapters/oidc/as7-eap6/as7-subsystem/src/main/resources/org/keycloak/subsystem/as7/LocalDescriptions.properties @@ -32,6 +32,9 @@ keycloak.realm.allow-any-hostname=SSL Setting keycloak.realm.truststore=Truststore used for adapter client HTTPS requests keycloak.realm.truststore-password=Password of the Truststore keycloak.realm.connection-pool-size=Connection pool size for the client used by the adapter +keycloak.realm.socket-timeout=Timeout for socket waiting for data in milliseconds +keycloak.realm.connection-ttl=Connection time to live in milliseconds +keycloak.realm.connection-timeout=Timeout for establishing the connection with the remote host in milliseconds keycloak.realm.enable-cors=Enable Keycloak CORS support keycloak.realm.client-keystore=n/a keycloak.realm.client-keystore-password=n/a @@ -61,6 +64,9 @@ keycloak.secure-deployment.allow-any-hostname=SSL Setting keycloak.secure-deployment.truststore=Truststore used for adapter client HTTPS requests keycloak.secure-deployment.truststore-password=Password of the Truststore keycloak.secure-deployment.connection-pool-size=Connection pool size for the client used by the adapter +keycloak.secure-deployment.socket-timeout=Timeout for socket waiting for data in milliseconds +keycloak.secure-deployment.connection-ttl=Connection time to live in milliseconds +keycloak.secure-deployment.connection-timeout=Timeout for establishing the connection with the remote host in milliseconds keycloak.secure-deployment.resource=Application name keycloak.secure-deployment.use-resource-role-mappings=Use resource level permissions from token keycloak.secure-deployment.credentials=Adapter credentials diff --git a/adapters/oidc/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/extension/KeycloakExtension.java b/adapters/oidc/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/extension/KeycloakExtension.java index 52113c0825..b0de116679 100755 --- a/adapters/oidc/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/extension/KeycloakExtension.java +++ b/adapters/oidc/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/extension/KeycloakExtension.java @@ -38,7 +38,7 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUB public class KeycloakExtension implements Extension { public static final String SUBSYSTEM_NAME = "keycloak"; - public static final String NAMESPACE = "urn:jboss:domain:keycloak:1.1"; + public static final String NAMESPACE = "urn:jboss:domain:keycloak:1.2"; private static final KeycloakSubsystemParser PARSER = new KeycloakSubsystemParser(); static final PathElement PATH_SUBSYSTEM = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME); private static final String RESOURCE_NAME = KeycloakExtension.class.getPackage().getName() + ".LocalDescriptions"; diff --git a/adapters/oidc/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/extension/SharedAttributeDefinitons.java b/adapters/oidc/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/extension/SharedAttributeDefinitons.java index 1366cb8247..54037727bd 100755 --- a/adapters/oidc/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/extension/SharedAttributeDefinitons.java +++ b/adapters/oidc/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/extension/SharedAttributeDefinitons.java @@ -19,6 +19,7 @@ package org.keycloak.subsystem.adapter.extension; import org.jboss.as.controller.SimpleAttributeDefinition; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.as.controller.operations.validation.IntRangeValidator; +import org.jboss.as.controller.operations.validation.LongRangeValidator; import org.jboss.as.controller.operations.validation.StringLengthValidator; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; @@ -81,6 +82,24 @@ public class SharedAttributeDefinitons { .setAllowExpression(true) .setValidator(new IntRangeValidator(0, true)) .build(); + protected static final SimpleAttributeDefinition SOCKET_TIMEOUT = + new SimpleAttributeDefinitionBuilder("socket-timeout", ModelType.LONG, true) + .setXmlName("socket-timeout") + .setAllowExpression(true) + .setValidator(new LongRangeValidator(-1L, true)) + .build(); + protected static final SimpleAttributeDefinition CONNECTION_TTL = + new SimpleAttributeDefinitionBuilder("connection-ttl", ModelType.LONG, true) + .setXmlName("connection-ttl") + .setAllowExpression(true) + .setValidator(new LongRangeValidator(-1L, true)) + .build(); + protected static final SimpleAttributeDefinition CONNECTION_TIMEOUT = + new SimpleAttributeDefinitionBuilder("connection-timeout", ModelType.LONG, true) + .setXmlName("connection-timeout") + .setAllowExpression(true) + .setValidator(new LongRangeValidator(-1L, true)) + .build(); protected static final SimpleAttributeDefinition ENABLE_CORS = new SimpleAttributeDefinitionBuilder("enable-cors", ModelType.BOOLEAN, true) @@ -219,6 +238,9 @@ public class SharedAttributeDefinitons { ATTRIBUTES.add(ALLOW_ANY_HOSTNAME); ATTRIBUTES.add(DISABLE_TRUST_MANAGER); ATTRIBUTES.add(CONNECTION_POOL_SIZE); + ATTRIBUTES.add(SOCKET_TIMEOUT); + ATTRIBUTES.add(CONNECTION_TTL); + ATTRIBUTES.add(CONNECTION_TIMEOUT); ATTRIBUTES.add(ENABLE_CORS); ATTRIBUTES.add(CLIENT_KEYSTORE); ATTRIBUTES.add(CLIENT_KEYSTORE_PASSWORD); diff --git a/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/org/keycloak/subsystem/adapter/extension/LocalDescriptions.properties b/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/org/keycloak/subsystem/adapter/extension/LocalDescriptions.properties index 3808f88640..2bf1044161 100755 --- a/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/org/keycloak/subsystem/adapter/extension/LocalDescriptions.properties +++ b/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/org/keycloak/subsystem/adapter/extension/LocalDescriptions.properties @@ -35,6 +35,9 @@ keycloak.realm.allow-any-hostname=SSL Setting keycloak.realm.truststore=Truststore used for adapter client HTTPS requests keycloak.realm.truststore-password=Password of the Truststore keycloak.realm.connection-pool-size=Connection pool size for the client used by the adapter +keycloak.realm.socket-timeout=Timeout for socket waiting for data in milliseconds +keycloak.realm.connection-ttl=Connection time to live in milliseconds +keycloak.realm.connection-timeout=Timeout for establishing the connection with the remote host in milliseconds keycloak.realm.enable-cors=Enable Keycloak CORS support keycloak.realm.client-keystore=n/a keycloak.realm.client-keystore-password=n/a @@ -68,6 +71,9 @@ keycloak.secure-deployment.allow-any-hostname=SSL Setting keycloak.secure-deployment.truststore=Truststore used for adapter client HTTPS requests keycloak.secure-deployment.truststore-password=Password of the Truststore keycloak.secure-deployment.connection-pool-size=Connection pool size for the client used by the adapter +keycloak.secure-deployment.socket-timeout=Timeout for socket waiting for data in milliseconds +keycloak.secure-deployment.connection-ttl=Connection time to live in milliseconds +keycloak.secure-deployment.connection-timeout=Timeout for establishing the connection with the remote host in milliseconds keycloak.secure-deployment.resource=Application name keycloak.secure-deployment.use-resource-role-mappings=Use resource level permissions from token keycloak.secure-deployment.credentials=Adapter credentials @@ -113,6 +119,9 @@ keycloak.secure-server.allow-any-hostname=SSL Setting keycloak.secure-server.truststore=Truststore used for adapter client HTTPS requests keycloak.secure-server.truststore-password=Password of the Truststore keycloak.secure-server.connection-pool-size=Connection pool size for the client used by the adapter +keycloak.secure-server.socket-timeout=Timeout for socket waiting for data in milliseconds +keycloak.secure-server.connection-ttl=Connection time to live in milliseconds +keycloak.secure-server.connection-timeout=Timeout for establishing the connection with the remote host in milliseconds keycloak.secure-server.resource=Application name keycloak.secure-server.use-resource-role-mappings=Use resource level permissions from token keycloak.secure-server.credentials=Adapter credentials diff --git a/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/schema/wildfly-keycloak_1_2.xsd b/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/schema/wildfly-keycloak_1_2.xsd new file mode 100755 index 0000000000..c5b3c29a8b --- /dev/null +++ b/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/schema/wildfly-keycloak_1_2.xsd @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The name of the realm. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The name of the realm. + + + + + + + + + + + + + + + + + diff --git a/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/subsystem-templates/keycloak-adapter.xml b/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/subsystem-templates/keycloak-adapter.xml index e8c09f3f8a..d895973d04 100644 --- a/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/subsystem-templates/keycloak-adapter.xml +++ b/adapters/oidc/wildfly/wildfly-subsystem/src/main/resources/subsystem-templates/keycloak-adapter.xml @@ -19,6 +19,6 @@ org.keycloak.keycloak-adapter-subsystem - + diff --git a/adapters/oidc/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/extension/SubsystemParsingTestCase.java b/adapters/oidc/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/extension/SubsystemParsingTestCase.java index eca49033b9..e60419b11e 100755 --- a/adapters/oidc/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/extension/SubsystemParsingTestCase.java +++ b/adapters/oidc/wildfly/wildfly-subsystem/src/test/java/org/keycloak/subsystem/adapter/extension/SubsystemParsingTestCase.java @@ -97,12 +97,12 @@ public class SubsystemParsingTestCase extends AbstractSubsystemBaseTest { @Override protected String getSubsystemXml() throws IOException { - return readResource("keycloak-1.1.xml"); + return readResource("keycloak-1.2.xml"); } @Override protected String getSubsystemXsdPath() throws Exception { - return "schema/wildfly-keycloak_1_1.xsd"; + return "schema/wildfly-keycloak_1_2.xsd"; } @Override diff --git a/adapters/oidc/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/extension/keycloak-1.1.xml b/adapters/oidc/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/extension/keycloak-1.2.xml similarity index 94% rename from adapters/oidc/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/extension/keycloak-1.1.xml rename to adapters/oidc/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/extension/keycloak-1.2.xml index 8810c99983..8f79908f13 100755 --- a/adapters/oidc/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/extension/keycloak-1.1.xml +++ b/adapters/oidc/wildfly/wildfly-subsystem/src/test/resources/org/keycloak/subsystem/adapter/extension/keycloak-1.2.xml @@ -15,7 +15,7 @@ ~ limitations under the License. --> - + MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4siLKUew0WYxdtq6/rwk4Uj/4amGFFnE/yzIxQVU0PUqz3QBRVkUWpDj0K6ZnS5nzJV/y6DHLEy7hjZTdRDphyF1sq09aDOYnVpzu8o2sIlMM8q5RnUyEfIyUZqwo8pSZDJ90fS0s+IDUJNCSIrAKO3w1lqZDHL6E/YFHXyzkvQIDAQAB http://localhost:8080/auth @@ -26,6 +26,9 @@ false true 20 + 2000 + 5000 + 3000 true keys.jks secret @@ -85,6 +88,9 @@ wildfly-management true EXTERNAL + 10000 + 40000 + 50000 preferred_username 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 ebec74b3b2..37011e13d3 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 @@ -93,6 +93,7 @@ public class Constants { static final String TRUSTSTORE_PASSWORD = "truststorePassword"; static final String SOCKET_TIMEOUT = "socketTimeout"; static final String CONNECTION_TIMEOUT = "connectionTimeout"; + static final String CONNECTION_TTL = "connectionTTL"; } static class XML { @@ -174,5 +175,6 @@ public class Constants { static final String TRUSTSTORE_PASSWORD = "truststorePassword"; static final String SOCKET_TIMEOUT = "socketTimeout"; static final String CONNECTION_TIMEOUT = "connectionTimeout"; + static final String CONNECTION_TTL = "connectionTTL"; } } 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 index 1881f497a3..2592e3050d 100644 --- 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 @@ -90,8 +90,14 @@ abstract class HttpClientDefinition { .setAllowExpression(true) .build(); + private static final SimpleAttributeDefinition CONNECTION_TTL = + new SimpleAttributeDefinitionBuilder(Constants.Model.CONNECTION_TTL, ModelType.LONG, true) + .setXmlName(Constants.XML.CONNECTION_TTL) + .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, SOCKET_TIMEOUT, CONNECTION_TIMEOUT}; + CONNECTION_POOL_SIZE, DISABLE_TRUST_MANAGER, PROXY_URL, TRUSTSTORE, TRUSTSTORE_PASSWORD, SOCKET_TIMEOUT, CONNECTION_TIMEOUT, CONNECTION_TTL}; private static final HashMap ATTRIBUTE_MAP = new HashMap<>(); 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 0d3fc07a69..49cac5df3d 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 @@ -101,4 +101,5 @@ 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 keycloak-saml.IDP.HttpClient.socketTimeout=Timeout for socket waiting for data -keycloak-saml.IDP.HttpClient.connectionTimeout=Timeout for establishing the connection with the remote host \ No newline at end of file +keycloak-saml.IDP.HttpClient.connectionTimeout=Timeout for establishing the connection with the remote host +keycloak-saml.IDP.HttpClient.connectionTTL=The connection time to live \ No newline at end of file diff --git a/adapters/saml/as7-eap6/subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_4.xsd b/adapters/saml/as7-eap6/subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_4.xsd index decb9392d5..8b8951e1c8 100644 --- a/adapters/saml/as7-eap6/subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_4.xsd +++ b/adapters/saml/as7-eap6/subsystem/src/main/resources/schema/wildfly-keycloak-saml_1_4.xsd @@ -1,7 +1,7 @@