Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f0ff23332 |
No files matched your search
@@ -32,10 +32,6 @@ To build the distribution run:
|
|||||||
|
|
||||||
Once completed you will find distribution archives in `distribution`.
|
Once completed you will find distribution archives in `distribution`.
|
||||||
|
|
||||||
To build only the server run:
|
|
||||||
|
|
||||||
mvn -Pdistribution -pl distribution/server-dist -am -Dmaven.test.skip clean install
|
|
||||||
|
|
||||||
|
|
||||||
Starting Keycloak
|
Starting Keycloak
|
||||||
-----------------
|
-----------------
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -36,16 +36,7 @@
|
|||||||
</keycloak.osgi.export>
|
</keycloak.osgi.export>
|
||||||
<keycloak.osgi.import>
|
<keycloak.osgi.import>
|
||||||
org.keycloak.*;version="${project.version}",
|
org.keycloak.*;version="${project.version}",
|
||||||
org.apache.http.auth.*;version=${apache.httpcomponents.version},
|
org.apache.http.*;version=${apache.httpcomponents.version},
|
||||||
org.apache.http.client.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.conn.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.cookie.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.auth.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.client.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.conn.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.cookie.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.execchain.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.*;version=${apache.httpcomponents.httpcore.version},
|
|
||||||
org.apache.karaf.jaas.boot.principal;resolution:=optional,
|
org.apache.karaf.jaas.boot.principal;resolution:=optional,
|
||||||
org.apache.karaf.jaas.modules;resolution:=optional,
|
org.apache.karaf.jaas.modules;resolution:=optional,
|
||||||
*;resolution:=optional
|
*;resolution:=optional
|
||||||
|
|||||||
+2
-6
@@ -67,12 +67,8 @@ public abstract class AbstractPolicyEnforcer {
|
|||||||
KeycloakSecurityContext securityContext = httpFacade.getSecurityContext();
|
KeycloakSecurityContext securityContext = httpFacade.getSecurityContext();
|
||||||
|
|
||||||
if (securityContext == null) {
|
if (securityContext == null) {
|
||||||
if (!isDefaultAccessDeniedUri(request)) {
|
if (pathConfig != null) {
|
||||||
if (pathConfig != null) {
|
challenge(pathConfig, getRequiredScopes(pathConfig, request), httpFacade);
|
||||||
challenge(pathConfig, getRequiredScopes(pathConfig, request), httpFacade);
|
|
||||||
} else {
|
|
||||||
handleAccessDenied(httpFacade);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return createEmptyAuthorizationContext(false);
|
return createEmptyAuthorizationContext(false);
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-9
@@ -122,6 +122,12 @@ public class KeycloakAdapterPolicyEnforcer extends AbstractPolicyEnforcer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleAccessDenied(OIDCHttpFacade facade) {
|
protected void handleAccessDenied(OIDCHttpFacade facade) {
|
||||||
|
KeycloakSecurityContext securityContext = facade.getSecurityContext();
|
||||||
|
|
||||||
|
if (securityContext == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String accessDeniedPath = getEnforcerConfig().getOnDenyRedirectTo();
|
String accessDeniedPath = getEnforcerConfig().getOnDenyRedirectTo();
|
||||||
HttpFacade.Response response = facade.getResponse();
|
HttpFacade.Response response = facade.getResponse();
|
||||||
|
|
||||||
@@ -205,16 +211,17 @@ public class KeycloakAdapterPolicyEnforcer extends AbstractPolicyEnforcer {
|
|||||||
|
|
||||||
private boolean isBearerAuthorization(OIDCHttpFacade httpFacade) {
|
private boolean isBearerAuthorization(OIDCHttpFacade httpFacade) {
|
||||||
List<String> authHeaders = httpFacade.getRequest().getHeaders("Authorization");
|
List<String> authHeaders = httpFacade.getRequest().getHeaders("Authorization");
|
||||||
|
if (authHeaders == null || authHeaders.size() == 0) {
|
||||||
if (authHeaders != null) {
|
return false;
|
||||||
for (String authHeader : authHeaders) {
|
|
||||||
String[] split = authHeader.trim().split("\\s+");
|
|
||||||
if (split == null || split.length != 2) continue;
|
|
||||||
if (!split[0].equalsIgnoreCase("Bearer")) continue;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return getPolicyEnforcer().getDeployment().isBearerOnly();
|
for (String authHeader : authHeaders) {
|
||||||
|
String[] split = authHeader.trim().split("\\s+");
|
||||||
|
if (split == null || split.length != 2) continue;
|
||||||
|
if (!split[0].equalsIgnoreCase("Bearer")) continue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak AS7 / JBoss EAP 6 Integration</name>
|
<name>Keycloak AS7 / JBoss EAP 6 Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-fuse7-integration-pom</artifactId>
|
<artifactId>keycloak-fuse7-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-fuse7-integration-pom</artifactId>
|
<artifactId>keycloak-fuse7-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
</keycloak.osgi.export>
|
</keycloak.osgi.export>
|
||||||
<keycloak.osgi.import>
|
<keycloak.osgi.import>
|
||||||
!org.keycloak.adapters.osgi.jetty94,
|
!org.keycloak.adapters.osgi.jetty94,
|
||||||
org.ops4j.pax.web.*;version="[7.1,9)",
|
|
||||||
org.keycloak.*;version="${project.version}",
|
org.keycloak.*;version="${project.version}",
|
||||||
*;resolution:=optional
|
*;resolution:=optional
|
||||||
</keycloak.osgi.import>
|
</keycloak.osgi.import>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-fuse7-integration-pom</artifactId>
|
<artifactId>keycloak-fuse7-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
</keycloak.osgi.export>
|
</keycloak.osgi.export>
|
||||||
<keycloak.osgi.import>
|
<keycloak.osgi.import>
|
||||||
!org.keycloak.adapters.osgi.tomcat,
|
!org.keycloak.adapters.osgi.tomcat,
|
||||||
org.ops4j.pax.web.*;version="[7.1,9)",
|
|
||||||
org.keycloak.*;version="${project.version}",
|
org.keycloak.*;version="${project.version}",
|
||||||
*;resolution:=optional
|
*;resolution:=optional
|
||||||
</keycloak.osgi.import>
|
</keycloak.osgi.import>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-fuse7-integration-pom</artifactId>
|
<artifactId>keycloak-fuse7-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
!org.keycloak.adapters.osgi.undertow,
|
!org.keycloak.adapters.osgi.undertow,
|
||||||
org.keycloak.*;version="${project.version}",
|
org.keycloak.*;version="${project.version}",
|
||||||
org.keycloak.adapters.osgi.*;version="${project.version}",
|
org.keycloak.adapters.osgi.*;version="${project.version}",
|
||||||
org.ops4j.pax.web.*;version="[7.1,9)",
|
org.ops4j.pax.web.*;version="[3.0,8)",
|
||||||
javax.servlet.*;version="[2.5,4)";resolution:=optional,
|
javax.servlet.*;version="[2.5,4)";resolution:=optional,
|
||||||
org.apache.cxf.transport.http;resolution:=optional;version="[3,4)",
|
org.apache.cxf.transport.http;resolution:=optional;version="[3,4)",
|
||||||
org.apache.cxf.transport.http_undertow;resolution:=optional;version="[3,4)",
|
org.apache.cxf.transport.http_undertow;resolution:=optional;version="[3,4)",
|
||||||
@@ -65,6 +65,11 @@
|
|||||||
<artifactId>org.osgi.enterprise</artifactId>
|
<artifactId>org.osgi.enterprise</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ops4j.pax.web</groupId>
|
||||||
|
<artifactId>pax-web-runtime</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.ops4j.pax.web</groupId>
|
<groupId>org.ops4j.pax.web</groupId>
|
||||||
<artifactId>pax-web-spi</artifactId>
|
<artifactId>pax-web-spi</artifactId>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak Jetty Integration</name>
|
<name>Keycloak Jetty Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+503
-503
File diff suppressed because it is too large.
Load diff
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -77,6 +77,11 @@
|
|||||||
<artifactId>org.osgi.enterprise</artifactId>
|
<artifactId>org.osgi.enterprise</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ops4j.pax.web</groupId>
|
||||||
|
<artifactId>pax-web-runtime</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.ops4j.pax.web</groupId>
|
<groupId>org.ops4j.pax.web</groupId>
|
||||||
<artifactId>pax-web-api</artifactId>
|
<artifactId>pax-web-api</artifactId>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak OIDC Client Adapter Modules</name>
|
<name>Keycloak OIDC Client Adapter Modules</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>spring-boot-container-bundle</artifactId>
|
<artifactId>spring-boot-container-bundle</artifactId>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<description/>
|
<description/>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-boot.version>2.0.3.RELEASE</spring-boot.version>
|
<spring-boot.version>2.0.0.RELEASE</spring-boot.version>
|
||||||
<spring.version>5.0.2.RELEASE</spring.version>
|
<spring.version>5.0.2.RELEASE</spring.version>
|
||||||
<mockito.version>1.9.5</mockito.version>
|
<mockito.version>1.9.5</mockito.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak Tomcat Integration</name>
|
<name>Keycloak Tomcat Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -95,10 +95,5 @@
|
|||||||
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
|
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.undertow</groupId>
|
|
||||||
<artifactId>undertow-servlet</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
+9
-3
@@ -78,7 +78,7 @@ public class ElytronAccount implements OidcKeycloakAccount {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean tryRefresh() {
|
boolean tryRefresh(CallbackHandler callbackHandler) {
|
||||||
log.debug("Trying to refresh");
|
log.debug("Trying to refresh");
|
||||||
|
|
||||||
RefreshableKeycloakSecurityContext securityContext = getKeycloakSecurityContext();
|
RefreshableKeycloakSecurityContext securityContext = getKeycloakSecurityContext();
|
||||||
@@ -88,8 +88,14 @@ public class ElytronAccount implements OidcKeycloakAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (securityContext.refreshExpiredToken(false)) {
|
if (securityContext.refreshExpiredToken(false)) {
|
||||||
log.debug("refresh succeeded");
|
SecurityIdentity securityIdentity = SecurityIdentityUtil.authorize(callbackHandler, principal);
|
||||||
return true;
|
|
||||||
|
if (securityIdentity != null) {
|
||||||
|
log.debug("refresh succeeded");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return checkActive();
|
return checkActive();
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ public class ElytronCookieTokenStore implements ElytronTokeStore {
|
|||||||
boolean active = account.checkActive();
|
boolean active = account.checkActive();
|
||||||
|
|
||||||
if (!active) {
|
if (!active) {
|
||||||
active = account.tryRefresh();
|
active = account.tryRefresh(this.callbackHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
|
|||||||
-14
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package org.keycloak.adapters.elytron;
|
package org.keycloak.adapters.elytron;
|
||||||
|
|
||||||
import io.undertow.server.handlers.CookieImpl;
|
|
||||||
import org.bouncycastle.asn1.cmp.Challenge;
|
import org.bouncycastle.asn1.cmp.Challenge;
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
import org.keycloak.KeycloakSecurityContext;
|
||||||
import org.keycloak.adapters.AdapterDeploymentContext;
|
import org.keycloak.adapters.AdapterDeploymentContext;
|
||||||
@@ -63,8 +62,6 @@ import java.util.function.Consumer;
|
|||||||
*/
|
*/
|
||||||
class ElytronHttpFacade implements OIDCHttpFacade {
|
class ElytronHttpFacade implements OIDCHttpFacade {
|
||||||
|
|
||||||
static final String UNDERTOW_EXCHANGE = ElytronHttpFacade.class.getName() + ".undertow.exchange";
|
|
||||||
|
|
||||||
private final HttpServerRequest request;
|
private final HttpServerRequest request;
|
||||||
private final CallbackHandler callbackHandler;
|
private final CallbackHandler callbackHandler;
|
||||||
private final AdapterTokenStore tokenStore;
|
private final AdapterTokenStore tokenStore;
|
||||||
@@ -315,17 +312,6 @@ class ElytronHttpFacade implements OIDCHttpFacade {
|
|||||||
@Override
|
@Override
|
||||||
public void resetCookie(final String name, final String path) {
|
public void resetCookie(final String name, final String path) {
|
||||||
responseConsumer = responseConsumer.andThen(response -> setCookie(name, "", path, null, 0, false, false, response));
|
responseConsumer = responseConsumer.andThen(response -> setCookie(name, "", path, null, 0, false, false, response));
|
||||||
HttpScope exchangeScope = getScope(Scope.EXCHANGE);
|
|
||||||
ProtectedHttpServerExchange undertowExchange = ProtectedHttpServerExchange.class.cast(exchangeScope.getAttachment(UNDERTOW_EXCHANGE));
|
|
||||||
|
|
||||||
if (undertowExchange != null) {
|
|
||||||
CookieImpl cookie = new CookieImpl(name, "");
|
|
||||||
|
|
||||||
cookie.setMaxAge(0);
|
|
||||||
cookie.setPath(path);
|
|
||||||
|
|
||||||
undertowExchange.getExchange().setResponseCookie(cookie);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ public class ElytronSessionTokenStore implements ElytronTokeStore {
|
|||||||
boolean active = account.checkActive();
|
boolean active = account.checkActive();
|
||||||
|
|
||||||
if (!active) {
|
if (!active) {
|
||||||
active = account.tryRefresh();
|
active = account.tryRefresh(this.callbackHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
|
|||||||
+1
-3
@@ -43,8 +43,7 @@ import java.io.InputStream;
|
|||||||
*/
|
*/
|
||||||
public class KeycloakConfigurationServletListener implements ServletContextListener {
|
public class KeycloakConfigurationServletListener implements ServletContextListener {
|
||||||
|
|
||||||
static final String ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE = AdapterDeploymentContext.class.getName();
|
static final String ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE = AdapterDeploymentContext.class.getName() + ".elytron";
|
||||||
static final String ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE_ELYTRON = AdapterDeploymentContext.class.getName() + ".elytron";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextInitialized(ServletContextEvent sce) {
|
public void contextInitialized(ServletContextEvent sce) {
|
||||||
@@ -77,7 +76,6 @@ public class KeycloakConfigurationServletListener implements ServletContextListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
servletContext.setAttribute(ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE, deploymentContext);
|
servletContext.setAttribute(ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE, deploymentContext);
|
||||||
servletContext.setAttribute(ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE_ELYTRON, deploymentContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -126,7 +126,7 @@ class KeycloakHttpServerAuthenticationMechanism implements HttpServerAuthenticat
|
|||||||
|
|
||||||
private AdapterDeploymentContext getDeploymentContext(HttpServerRequest request) {
|
private AdapterDeploymentContext getDeploymentContext(HttpServerRequest request) {
|
||||||
if (this.deploymentContext == null) {
|
if (this.deploymentContext == null) {
|
||||||
return (AdapterDeploymentContext) request.getScope(Scope.APPLICATION).getAttachment(KeycloakConfigurationServletListener.ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE_ELYTRON);
|
return (AdapterDeploymentContext) request.getScope(Scope.APPLICATION).getAttachment(KeycloakConfigurationServletListener.ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.deploymentContext;
|
return this.deploymentContext;
|
||||||
|
|||||||
-42
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 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.adapters.elytron;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
import javax.servlet.ServletRequest;
|
|
||||||
|
|
||||||
import io.undertow.server.HttpHandler;
|
|
||||||
import io.undertow.servlet.ServletExtension;
|
|
||||||
import io.undertow.servlet.api.DeploymentInfo;
|
|
||||||
import io.undertow.servlet.handlers.ServletRequestContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
|
||||||
*/
|
|
||||||
public class KeycloakServletExtension implements ServletExtension {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {
|
|
||||||
deploymentInfo.addOuterHandlerChainWrapper(handler -> (HttpHandler) exchange -> {
|
|
||||||
ServletRequest servletRequest = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getServletRequest();
|
|
||||||
|
|
||||||
servletRequest.setAttribute(ElytronHttpFacade.UNDERTOW_EXCHANGE, new ProtectedHttpServerExchange(exchange));
|
|
||||||
|
|
||||||
handler.handleRequest(exchange);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-42
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 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.adapters.elytron;
|
|
||||||
|
|
||||||
import io.undertow.server.HttpServerExchange;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>A wrapper for {@code {@link HttpServerExchange}} accessible only from classes in the same package.
|
|
||||||
*
|
|
||||||
* <p>This class is used to provide to the elytron mechanism access to the current exchange in order to allow making
|
|
||||||
* changes to the exchange (e.g. response) during the evaluation of requests. By default, changes to the exchange are only
|
|
||||||
* propagated after the execution of the mechanism. But in certain situations, such as when making a programmatic logout (HttpServletRequest.logout()) from
|
|
||||||
* within application code, any change made to the exchange is not propagated.
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
|
||||||
*/
|
|
||||||
class ProtectedHttpServerExchange {
|
|
||||||
|
|
||||||
private final HttpServerExchange exchange;
|
|
||||||
|
|
||||||
public ProtectedHttpServerExchange(HttpServerExchange exchange) {
|
|
||||||
this.exchange = exchange;
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpServerExchange getExchange() {
|
|
||||||
return exchange;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-52
@@ -1,52 +0,0 @@
|
|||||||
#
|
|
||||||
# * Copyright 2018 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# * Copyright 2018 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2016 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
org.keycloak.adapters.elytron.KeycloakServletExtension
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak WildFly Integration</name>
|
<name>Keycloak WildFly Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+16
-61
@@ -17,6 +17,21 @@
|
|||||||
|
|
||||||
package org.keycloak.adapters.wildfly;
|
package org.keycloak.adapters.wildfly;
|
||||||
|
|
||||||
|
import io.undertow.security.api.SecurityContext;
|
||||||
|
import io.undertow.server.HttpServerExchange;
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
import org.jboss.security.NestableGroup;
|
||||||
|
import org.jboss.security.SecurityConstants;
|
||||||
|
import org.jboss.security.SecurityContextAssociation;
|
||||||
|
import org.jboss.security.SimpleGroup;
|
||||||
|
import org.jboss.security.SimplePrincipal;
|
||||||
|
import org.keycloak.adapters.AdapterTokenStore;
|
||||||
|
import org.keycloak.adapters.KeycloakDeployment;
|
||||||
|
import org.keycloak.adapters.spi.HttpFacade;
|
||||||
|
import org.keycloak.adapters.undertow.KeycloakUndertowAccount;
|
||||||
|
import org.keycloak.adapters.undertow.ServletRequestAuthenticator;
|
||||||
|
|
||||||
|
import javax.security.auth.Subject;
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
import java.security.acl.Group;
|
import java.security.acl.Group;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -24,33 +39,11 @@ import java.util.Enumeration;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.security.auth.Subject;
|
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
|
||||||
import org.jboss.security.NestableGroup;
|
|
||||||
import org.jboss.security.SecurityConstants;
|
|
||||||
import org.jboss.security.SecurityContextAssociation;
|
|
||||||
import org.jboss.security.SimpleGroup;
|
|
||||||
import org.jboss.security.SimplePrincipal;
|
|
||||||
import org.jboss.security.SubjectInfo;
|
|
||||||
import org.jboss.security.identity.RoleGroup;
|
|
||||||
import org.jboss.security.identity.plugins.SimpleRole;
|
|
||||||
import org.jboss.security.identity.plugins.SimpleRoleGroup;
|
|
||||||
import org.keycloak.adapters.AdapterTokenStore;
|
|
||||||
import org.keycloak.adapters.KeycloakDeployment;
|
|
||||||
import org.keycloak.adapters.spi.HttpFacade;
|
|
||||||
import org.keycloak.adapters.undertow.KeycloakUndertowAccount;
|
|
||||||
import org.keycloak.adapters.undertow.ServletRequestAuthenticator;
|
|
||||||
|
|
||||||
import io.undertow.security.api.SecurityContext;
|
|
||||||
import io.undertow.server.HttpServerExchange;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
*/
|
*/
|
||||||
public class WildflyRequestAuthenticator extends ServletRequestAuthenticator
|
public class WildflyRequestAuthenticator extends ServletRequestAuthenticator {
|
||||||
{
|
|
||||||
protected static Logger log = Logger.getLogger(WildflyRequestAuthenticator.class);
|
protected static Logger log = Logger.getLogger(WildflyRequestAuthenticator.class);
|
||||||
|
|
||||||
public WildflyRequestAuthenticator(HttpFacade facade, KeycloakDeployment deployment, int sslRedirectPort,
|
public WildflyRequestAuthenticator(HttpFacade facade, KeycloakDeployment deployment, int sslRedirectPort,
|
||||||
@@ -94,13 +87,6 @@ public class WildflyRequestAuthenticator extends ServletRequestAuthenticator
|
|||||||
org.jboss.security.SecurityContext sc = SecurityContextAssociation.getSecurityContext();
|
org.jboss.security.SecurityContext sc = SecurityContextAssociation.getSecurityContext();
|
||||||
Principal userPrincipal = getPrincipal(subject);
|
Principal userPrincipal = getPrincipal(subject);
|
||||||
sc.getUtil().createSubjectInfo(userPrincipal, account, subject);
|
sc.getUtil().createSubjectInfo(userPrincipal, account, subject);
|
||||||
|
|
||||||
// Roles of subjectInfo are null, because is was constructed by
|
|
||||||
// org.jboss.security.identity.extensions.CredentialIdentityFactory
|
|
||||||
// .createIdentity(Principal [=userPrincipal], Object [=account], Role [=null]).
|
|
||||||
// Therefore the roles are only contained in the authenticatedSubject (member of subjectInfo)
|
|
||||||
// and subsequent logics do only access subjectInfo#roles instead of authenticatedSubject#roles.
|
|
||||||
mapGroupMembersOfAuthenticatedSubjectIntoSecurityContext(sc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,35 +150,4 @@ public class WildflyRequestAuthenticator extends ServletRequestAuthenticator
|
|||||||
return roleSets;
|
return roleSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void mapGroupMembersOfAuthenticatedSubjectIntoSecurityContext(org.jboss.security.SecurityContext sc) {
|
|
||||||
SubjectInfo subjectInfo = sc.getSubjectInfo();
|
|
||||||
if (subjectInfo == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Subject authenticatedSubject = subjectInfo.getAuthenticatedSubject();
|
|
||||||
if (authenticatedSubject == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get role group of security context in order to add roles of authenticatedSubject.
|
|
||||||
RoleGroup scRoles = sc.getUtil().getRoles();
|
|
||||||
if (scRoles == null) {
|
|
||||||
scRoles = new SimpleRoleGroup("Roles");
|
|
||||||
sc.getUtil().setRoles(scRoles);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get group roles of authenticatedSubject and add each role of the group into security context
|
|
||||||
Iterator<Principal> principalItr = authenticatedSubject.getPrincipals().iterator();
|
|
||||||
while (principalItr.hasNext()) {
|
|
||||||
Principal principal = principalItr.next();
|
|
||||||
if (principal instanceof Group) {
|
|
||||||
Enumeration<? extends Principal> members = ((Group) principal).members();
|
|
||||||
while (members.hasMoreElements()) {
|
|
||||||
Principal role = members.nextElement();
|
|
||||||
scRoles.addRole(new SimpleRole(role.getName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
-58
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 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.extension;
|
|
||||||
|
|
||||||
import org.jboss.as.server.deployment.DeploymentPhaseContext;
|
|
||||||
import org.jboss.as.server.deployment.DeploymentUnit;
|
|
||||||
import org.jboss.as.web.common.WarMetaData;
|
|
||||||
import org.jboss.metadata.web.jboss.JBossWebMetaData;
|
|
||||||
import org.jboss.msc.service.ServiceName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility class for Elytron integration
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
|
||||||
*/
|
|
||||||
public final class Elytron {
|
|
||||||
|
|
||||||
private static final String DEFAULT_SECURITY_DOMAIN = "other";
|
|
||||||
private static final String UNDERTOW_APPLICATION_SECURITY_DOMAIN = "org.wildfly.undertow.application-security-domain.";
|
|
||||||
|
|
||||||
static boolean isElytronEnabled(DeploymentPhaseContext phaseContext) {
|
|
||||||
String securityDomain = getSecurityDomain(phaseContext.getDeploymentUnit());
|
|
||||||
ServiceName serviceName = ServiceName.parse(new StringBuilder(UNDERTOW_APPLICATION_SECURITY_DOMAIN).append(securityDomain).toString());
|
|
||||||
return phaseContext.getServiceRegistry().getService(serviceName) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSecurityDomain(DeploymentUnit deploymentUnit) {
|
|
||||||
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
|
|
||||||
|
|
||||||
if (warMetaData != null) {
|
|
||||||
JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData();
|
|
||||||
|
|
||||||
if (webMetaData != null) {
|
|
||||||
String configuredSecurityDomain = webMetaData.getSecurityDomain();
|
|
||||||
|
|
||||||
if (configuredSecurityDomain != null) {
|
|
||||||
return configuredSecurityDomain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return DEFAULT_SECURITY_DOMAIN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+6
-11
@@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
package org.keycloak.subsystem.adapter.extension;
|
package org.keycloak.subsystem.adapter.extension;
|
||||||
|
|
||||||
import static org.keycloak.subsystem.adapter.extension.Elytron.isElytronEnabled;
|
|
||||||
|
|
||||||
import org.jboss.as.server.deployment.DeploymentPhaseContext;
|
import org.jboss.as.server.deployment.DeploymentPhaseContext;
|
||||||
import org.jboss.as.server.deployment.DeploymentUnit;
|
import org.jboss.as.server.deployment.DeploymentUnit;
|
||||||
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
|
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
|
||||||
@@ -75,7 +73,7 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||||||
addKeycloakAuthData(phaseContext, service);
|
addKeycloakAuthData(phaseContext, service);
|
||||||
}
|
}
|
||||||
|
|
||||||
addConfigurationListener(phaseContext);
|
addConfigurationListener(deploymentUnit);
|
||||||
|
|
||||||
// FYI, Undertow Extension will find deployments that have auth-method set to KEYCLOAK
|
// FYI, Undertow Extension will find deployments that have auth-method set to KEYCLOAK
|
||||||
|
|
||||||
@@ -127,8 +125,7 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||||||
webMetaData.setContextParams(contextParams);
|
webMetaData.setContextParams(contextParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addConfigurationListener(DeploymentPhaseContext phaseContext) {
|
private void addConfigurationListener(DeploymentUnit deploymentUnit) {
|
||||||
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
|
|
||||||
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
|
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
|
||||||
if (warMetaData == null) {
|
if (warMetaData == null) {
|
||||||
return;
|
return;
|
||||||
@@ -147,18 +144,16 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||||||
if (!loginConfig.getAuthMethod().equals("KEYCLOAK")) {
|
if (!loginConfig.getAuthMethod().equals("KEYCLOAK")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ListenerMetaData listenerMetaData = new ListenerMetaData();
|
||||||
|
|
||||||
if (isElytronEnabled(phaseContext)) {
|
listenerMetaData.setListenerClass(KeycloakConfigurationServletListener.class.getName());
|
||||||
ListenerMetaData listenerMetaData = new ListenerMetaData();
|
|
||||||
|
|
||||||
listenerMetaData.setListenerClass(KeycloakConfigurationServletListener.class.getName());
|
webMetaData.getListeners().add(listenerMetaData);
|
||||||
|
|
||||||
webMetaData.getListeners().add(listenerMetaData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void undeploy(DeploymentUnit du) {
|
public void undeploy(DeploymentUnit du) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-2
@@ -63,7 +63,7 @@ public abstract class KeycloakDependencyProcessor implements DeploymentUnitProce
|
|||||||
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
|
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
|
||||||
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
|
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
|
||||||
addCommonModules(moduleSpecification, moduleLoader);
|
addCommonModules(moduleSpecification, moduleLoader);
|
||||||
addPlatformSpecificModules(phaseContext, moduleSpecification, moduleLoader);
|
addPlatformSpecificModules(moduleSpecification, moduleLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
|
private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
|
||||||
@@ -74,7 +74,7 @@ public abstract class KeycloakDependencyProcessor implements DeploymentUnitProce
|
|||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected void addPlatformSpecificModules(DeploymentPhaseContext phaseContext, ModuleSpecification moduleSpecification, ModuleLoader moduleLoader);
|
abstract protected void addPlatformSpecificModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void undeploy(DeploymentUnit du) {
|
public void undeploy(DeploymentUnit du) {
|
||||||
|
|||||||
+4
-10
@@ -17,9 +17,6 @@
|
|||||||
|
|
||||||
package org.keycloak.subsystem.adapter.extension;
|
package org.keycloak.subsystem.adapter.extension;
|
||||||
|
|
||||||
import static org.keycloak.subsystem.adapter.extension.Elytron.isElytronEnabled;
|
|
||||||
|
|
||||||
import org.jboss.as.server.deployment.DeploymentPhaseContext;
|
|
||||||
import org.jboss.as.server.deployment.module.ModuleDependency;
|
import org.jboss.as.server.deployment.module.ModuleDependency;
|
||||||
import org.jboss.as.server.deployment.module.ModuleSpecification;
|
import org.jboss.as.server.deployment.module.ModuleSpecification;
|
||||||
import org.jboss.modules.ModuleIdentifier;
|
import org.jboss.modules.ModuleIdentifier;
|
||||||
@@ -37,12 +34,9 @@ public class KeycloakDependencyProcessorWildFly extends KeycloakDependencyProces
|
|||||||
private static final ModuleIdentifier KEYCLOAK_UNDERTOW_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-undertow-adapter");
|
private static final ModuleIdentifier KEYCLOAK_UNDERTOW_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-undertow-adapter");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addPlatformSpecificModules(DeploymentPhaseContext phaseContext, ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
|
protected void addPlatformSpecificModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
|
||||||
if (isElytronEnabled(phaseContext)) {
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_WILDFLY_ADAPTER, false, false, true, false));
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_ELYTRON_ADAPTER, true, false, true, false));
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_UNDERTOW_ADAPTER, false, false, false, false));
|
||||||
} else {
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_ELYTRON_ADAPTER, true, false, false, false));
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_WILDFLY_ADAPTER, false, false, true, false));
|
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_UNDERTOW_ADAPTER, false, false, false, false));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak Adapters</name>
|
<name>Keycloak Adapters</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML EAP Integration</name>
|
<name>Keycloak SAML EAP Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+1
-1
@@ -339,7 +339,7 @@ public abstract class AbstractSamlAuthenticationHandler implements SamlAuthentic
|
|||||||
return AuthOutcome.FAILED;
|
return AuthOutcome.FAILED;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
assertion = AssertionUtil.getAssertion(responseHolder, responseType, deployment.getDecryptionKey());
|
assertion = AssertionUtil.getAssertion(responseType, deployment.getDecryptionKey());
|
||||||
if (AssertionUtil.hasExpired(assertion)) {
|
if (AssertionUtil.hasExpired(assertion)) {
|
||||||
return initiateLogin();
|
return initiateLogin();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML Jetty Integration</name>
|
<name>Keycloak SAML Jetty Integration</name>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML Client Adapter Modules</name>
|
<name>Keycloak SAML Client Adapter Modules</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+4
-12
@@ -52,7 +52,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
@@ -62,7 +61,6 @@ public class SamlFilter implements Filter {
|
|||||||
protected SamlDeploymentContext deploymentContext;
|
protected SamlDeploymentContext deploymentContext;
|
||||||
protected SessionIdMapper idMapper;
|
protected SessionIdMapper idMapper;
|
||||||
private final static Logger log = Logger.getLogger("" + SamlFilter.class);
|
private final static Logger log = Logger.getLogger("" + SamlFilter.class);
|
||||||
private static final Pattern PROTOCOL_PATTERN = Pattern.compile("^[a-zA-Z][a-zA-Z0-9+.-]*:");
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||||
@@ -139,7 +137,7 @@ public class SamlFilter implements Filter {
|
|||||||
}
|
}
|
||||||
FilterSamlSessionStore tokenStore = new FilterSamlSessionStore(request, facade, 100000, idMapper);
|
FilterSamlSessionStore tokenStore = new FilterSamlSessionStore(request, facade, 100000, idMapper);
|
||||||
boolean isEndpoint = request.getRequestURI().substring(request.getContextPath().length()).endsWith("/saml");
|
boolean isEndpoint = request.getRequestURI().substring(request.getContextPath().length()).endsWith("/saml");
|
||||||
SamlAuthenticator authenticator;
|
SamlAuthenticator authenticator = null;
|
||||||
if (isEndpoint) {
|
if (isEndpoint) {
|
||||||
authenticator = new SamlAuthenticator(facade, deployment, tokenStore) {
|
authenticator = new SamlAuthenticator(facade, deployment, tokenStore) {
|
||||||
@Override
|
@Override
|
||||||
@@ -178,15 +176,9 @@ public class SamlFilter implements Filter {
|
|||||||
}
|
}
|
||||||
if (outcome == AuthOutcome.LOGGED_OUT) {
|
if (outcome == AuthOutcome.LOGGED_OUT) {
|
||||||
tokenStore.logoutAccount();
|
tokenStore.logoutAccount();
|
||||||
String logoutPage = deployment.getLogoutPage();
|
if (deployment.getLogoutPage() != null) {
|
||||||
if (logoutPage != null) {
|
RequestDispatcher disp = req.getRequestDispatcher(deployment.getLogoutPage());
|
||||||
if (PROTOCOL_PATTERN.matcher(logoutPage).find()) {
|
disp.forward(req, res);
|
||||||
response.sendRedirect(logoutPage);
|
|
||||||
log.log(Level.FINE, "Redirected to logout page {0}", logoutPage);
|
|
||||||
} else {
|
|
||||||
RequestDispatcher disp = req.getRequestDispatcher(logoutPage);
|
|
||||||
disp.forward(req, res);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
chain.doFilter(req, res);
|
chain.doFilter(req, res);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML Tomcat Integration</name>
|
<name>Keycloak SAML Tomcat Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+1
-3
@@ -49,8 +49,7 @@ public class KeycloakConfigurationServletListener implements ServletContextListe
|
|||||||
|
|
||||||
protected static Logger log = Logger.getLogger(KeycloakConfigurationServletListener.class);
|
protected static Logger log = Logger.getLogger(KeycloakConfigurationServletListener.class);
|
||||||
|
|
||||||
static final String ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE = SamlDeploymentContext.class.getName();
|
static final String ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE = SamlDeploymentContext.class.getName() + ".elytron";
|
||||||
static final String ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE_ELYTRON = SamlDeploymentContext.class.getName() + ".elytron";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextInitialized(ServletContextEvent sce) {
|
public void contextInitialized(ServletContextEvent sce) {
|
||||||
@@ -94,7 +93,6 @@ public class KeycloakConfigurationServletListener implements ServletContextListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
servletContext.setAttribute(ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE, deploymentContext);
|
servletContext.setAttribute(ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE, deploymentContext);
|
||||||
servletContext.setAttribute(ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE_ELYTRON, deploymentContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -131,7 +131,7 @@ class KeycloakHttpServerAuthenticationMechanism implements HttpServerAuthenticat
|
|||||||
|
|
||||||
private SamlDeploymentContext getDeploymentContext(HttpServerRequest request) {
|
private SamlDeploymentContext getDeploymentContext(HttpServerRequest request) {
|
||||||
if (this.deploymentContext == null) {
|
if (this.deploymentContext == null) {
|
||||||
return (SamlDeploymentContext) request.getScope(Scope.APPLICATION).getAttachment(KeycloakConfigurationServletListener.ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE_ELYTRON);
|
return (SamlDeploymentContext) request.getScope(Scope.APPLICATION).getAttachment(KeycloakConfigurationServletListener.ADAPTER_DEPLOYMENT_CONTEXT_ATTRIBUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.deploymentContext;
|
return this.deploymentContext;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML Wildfly Integration</name>
|
<name>Keycloak SAML Wildfly Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
-58
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 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 org.jboss.as.server.deployment.DeploymentPhaseContext;
|
|
||||||
import org.jboss.as.server.deployment.DeploymentUnit;
|
|
||||||
import org.jboss.as.web.common.WarMetaData;
|
|
||||||
import org.jboss.metadata.web.jboss.JBossWebMetaData;
|
|
||||||
import org.jboss.msc.service.ServiceName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility class for Elytron integration
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
|
||||||
*/
|
|
||||||
public final class Elytron {
|
|
||||||
|
|
||||||
private static final String DEFAULT_SECURITY_DOMAIN = "other";
|
|
||||||
private static final String UNDERTOW_APPLICATION_SECURITY_DOMAIN = "org.wildfly.undertow.application-security-domain.";
|
|
||||||
|
|
||||||
static boolean isElytronEnabled(DeploymentPhaseContext phaseContext) {
|
|
||||||
String securityDomain = getSecurityDomain(phaseContext.getDeploymentUnit());
|
|
||||||
ServiceName serviceName = ServiceName.parse(new StringBuilder(UNDERTOW_APPLICATION_SECURITY_DOMAIN).append(securityDomain).toString());
|
|
||||||
return phaseContext.getServiceRegistry().getService(serviceName) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSecurityDomain(DeploymentUnit deploymentUnit) {
|
|
||||||
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
|
|
||||||
|
|
||||||
if (warMetaData != null) {
|
|
||||||
JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData();
|
|
||||||
|
|
||||||
if (webMetaData != null) {
|
|
||||||
String configuredSecurityDomain = webMetaData.getSecurityDomain();
|
|
||||||
|
|
||||||
if (configuredSecurityDomain != null) {
|
|
||||||
return configuredSecurityDomain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return DEFAULT_SECURITY_DOMAIN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+5
-11
@@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
package org.keycloak.subsystem.adapter.saml.extension;
|
package org.keycloak.subsystem.adapter.saml.extension;
|
||||||
|
|
||||||
import static org.keycloak.subsystem.adapter.saml.extension.Elytron.isElytronEnabled;
|
|
||||||
|
|
||||||
import org.jboss.as.server.deployment.DeploymentPhaseContext;
|
import org.jboss.as.server.deployment.DeploymentPhaseContext;
|
||||||
import org.jboss.as.server.deployment.DeploymentUnit;
|
import org.jboss.as.server.deployment.DeploymentUnit;
|
||||||
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
|
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
|
||||||
@@ -57,7 +55,7 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||||||
addKeycloakSamlAuthData(phaseContext);
|
addKeycloakSamlAuthData(phaseContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
addConfigurationListener(phaseContext);
|
addConfigurationListener(deploymentUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addKeycloakSamlAuthData(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
|
private void addKeycloakSamlAuthData(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
|
||||||
@@ -131,8 +129,7 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addConfigurationListener(DeploymentPhaseContext phaseContext) {
|
private void addConfigurationListener(DeploymentUnit deploymentUnit) {
|
||||||
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
|
|
||||||
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
|
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
|
||||||
if (warMetaData == null) {
|
if (warMetaData == null) {
|
||||||
return;
|
return;
|
||||||
@@ -151,13 +148,10 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||||||
if (!loginConfig.getAuthMethod().equals("KEYCLOAK-SAML")) {
|
if (!loginConfig.getAuthMethod().equals("KEYCLOAK-SAML")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ListenerMetaData listenerMetaData = new ListenerMetaData();
|
||||||
|
|
||||||
if (isElytronEnabled(phaseContext)) {
|
listenerMetaData.setListenerClass(KeycloakConfigurationServletListener.class.getName());
|
||||||
ListenerMetaData listenerMetaData = new ListenerMetaData();
|
|
||||||
|
|
||||||
listenerMetaData.setListenerClass(KeycloakConfigurationServletListener.class.getName());
|
webMetaData.getListeners().add(listenerMetaData);
|
||||||
|
|
||||||
webMetaData.getListeners().add(listenerMetaData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -65,7 +65,7 @@ public abstract class KeycloakDependencyProcessor implements DeploymentUnitProce
|
|||||||
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
|
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
|
||||||
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
|
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
|
||||||
addCommonModules(moduleSpecification, moduleLoader);
|
addCommonModules(moduleSpecification, moduleLoader);
|
||||||
addPlatformSpecificModules(phaseContext, moduleSpecification, moduleLoader);
|
addPlatformSpecificModules(moduleSpecification, moduleLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
|
private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
|
||||||
@@ -76,7 +76,7 @@ public abstract class KeycloakDependencyProcessor implements DeploymentUnitProce
|
|||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected void addPlatformSpecificModules(DeploymentPhaseContext phaseContext, ModuleSpecification moduleSpecification, ModuleLoader moduleLoader);
|
abstract protected void addPlatformSpecificModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void undeploy(DeploymentUnit du) {
|
public void undeploy(DeploymentUnit du) {
|
||||||
|
|||||||
+5
-10
@@ -17,9 +17,6 @@
|
|||||||
|
|
||||||
package org.keycloak.subsystem.adapter.saml.extension;
|
package org.keycloak.subsystem.adapter.saml.extension;
|
||||||
|
|
||||||
import static org.keycloak.subsystem.adapter.saml.extension.Elytron.isElytronEnabled;
|
|
||||||
|
|
||||||
import org.jboss.as.server.deployment.DeploymentPhaseContext;
|
|
||||||
import org.jboss.as.server.deployment.module.ModuleDependency;
|
import org.jboss.as.server.deployment.module.ModuleDependency;
|
||||||
import org.jboss.as.server.deployment.module.ModuleSpecification;
|
import org.jboss.as.server.deployment.module.ModuleSpecification;
|
||||||
import org.jboss.modules.ModuleIdentifier;
|
import org.jboss.modules.ModuleIdentifier;
|
||||||
@@ -37,12 +34,10 @@ public class KeycloakDependencyProcessorWildFly extends KeycloakDependencyProces
|
|||||||
private static final ModuleIdentifier KEYCLOAK_UNDERTOW_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-saml-undertow-adapter");
|
private static final ModuleIdentifier KEYCLOAK_UNDERTOW_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-saml-undertow-adapter");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addPlatformSpecificModules(DeploymentPhaseContext phaseContext, ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
|
protected void addPlatformSpecificModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
|
||||||
if (isElytronEnabled(phaseContext)) {
|
// ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_ELYTRON_ADAPTER, true, false, false, false));
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_WILDFLY_ADAPTER, false, false, true, false));
|
||||||
} else {
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_UNDERTOW_ADAPTER, false, false, false, false));
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_WILDFLY_ADAPTER, false, false, true, false));
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_ELYTRON_ADAPTER, true, false, false, false));
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_UNDERTOW_ADAPTER, false, false, false, false));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak Client Adapter SPI Modules</name>
|
<name>Keycloak Client Adapter SPI Modules</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+2
-11
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-authz-parent</artifactId>
|
<artifactId>keycloak-authz-parent</artifactId>
|
||||||
<version>4.1.0.Final</version>
|
<version>4.0.0.Final</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@@ -23,16 +23,7 @@
|
|||||||
</keycloak.osgi.export>
|
</keycloak.osgi.export>
|
||||||
<keycloak.osgi.import>
|
<keycloak.osgi.import>
|
||||||
org.keycloak.*;version="${project.version}",
|
org.keycloak.*;version="${project.version}",
|
||||||
org.apache.http.auth.*;version=${apache.httpcomponents.version},
|
org.apache.http.*;version=${apache.httpcomponents.version},
|
||||||
org.apache.http.client.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.conn.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.cookie.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.auth.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.client.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.conn.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.cookie.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.impl.execchain.*;version=${apache.httpcomponents.version},
|
|
||||||
org.apache.http.*;version=${apache.httpcomponents.httpcore.version},
|
|
||||||
*;resolution:=optional
|
*;resolution:=optional
|
||||||
</keycloak.osgi.import>
|
</keycloak.osgi.import>
|
||||||
</properties>
|
</properties>
|
||||||
|
|||||||
Loaded 100 of 929 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user