commit
4c71eeb627
30 changed files with 154 additions and 168 deletions
|
@ -80,6 +80,33 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>xml-maven-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-resources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>${project.build.directory}/unpacked/wildfly-${wildfly.version}/standalone/configuration</dir>
|
||||
<stylesheet>src/main/xslt/standalone.xsl</stylesheet>
|
||||
<includes>
|
||||
<include>standalone*.xml</include>
|
||||
</includes>
|
||||
<outputDir>${project.build.directory}/unpacked/wildfly-${wildfly.version}/standalone/configuration</outputDir>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
<targetDirectory>${project.build.directory}</targetDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
|
|
32
distribution/appliance-dist/src/main/xslt/standalone.xsl
Executable file
32
distribution/appliance-dist/src/main/xslt/standalone.xsl
Executable file
|
@ -0,0 +1,32 @@
|
|||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xalan="http://xml.apache.org/xalan"
|
||||
xmlns:j="urn:jboss:domain:1.3"
|
||||
version="2.0"
|
||||
exclude-result-prefixes="xalan j">
|
||||
|
||||
<xsl:param name="config"/>
|
||||
|
||||
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
|
||||
<xsl:strip-space elements="*"/>
|
||||
|
||||
<xsl:template match="node()[name(.)='extensions']">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()|@*"/>
|
||||
<extension module="org.keycloak.keycloak-wildfly-subsystem"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="node()[name(.)='profile']">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()|@*"/>
|
||||
<subsystem xmlns="urn:jboss:domain:keycloak:1.0"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -2,35 +2,13 @@
|
|||
|
||||
<target name="all">
|
||||
<delete dir="target/examples"/>
|
||||
<copy todir="target/examples/as7-eap-demo" overwrite="true">
|
||||
<copy todir="target/examples/preconfigured-demo" overwrite="true">
|
||||
<fileset dir="../../examples/demo-template">
|
||||
<exclude name="**/*.wildfly"/>
|
||||
<exclude name="**/target/**"/>
|
||||
<exclude name="**/*.iml"/>
|
||||
<exclude name="**/*.unconfigured"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<move file="target/examples/as7-eap-demo/README.md.as7" tofile="target/examples/as7-eap-demo/README.md"/>
|
||||
<move file="target/examples/as7-eap-demo/customer-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml.as7" tofile="target/examples/as7-eap-demo/customer-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml"/>
|
||||
<move file="target/examples/as7-eap-demo/product-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml.as7" tofile="target/examples/as7-eap-demo/product-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml"/>
|
||||
<move file="target/examples/as7-eap-demo/database-service/src/main/webapp/WEB-INF/jboss-deployment-structure.xml.as7" tofile="target/examples/as7-eap-demo/database-service/src/main/webapp/WEB-INF/jboss-deployment-structure.xml"/>
|
||||
<copy todir="target/examples/wildfly-demo" overwrite="true">
|
||||
<fileset dir="../../examples/demo-template">
|
||||
<exclude name="**/*.as7"/>
|
||||
<exclude name="**/WEB-INF/jboss-web.xml"/>
|
||||
<exclude name="**/WEB-INF/web.xml"/>
|
||||
<exclude name="**/target/**"/>
|
||||
<exclude name="**/*.iml"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<move file="target/examples/wildfly-demo/README.md.wildfly" tofile="target/examples/wildfly-demo/README.md"/>
|
||||
<move file="target/examples/wildfly-demo/customer-app/src/main/webapp/WEB-INF/web.xml.wildfly" tofile="target/examples/wildfly-demo/customer-app/src/main/webapp/WEB-INF/web.xml"/>
|
||||
<move file="target/examples/wildfly-demo/customer-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml.wildfly" tofile="target/examples/wildfly-demo/customer-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml"/>
|
||||
<move file="target/examples/wildfly-demo/product-app/src/main/webapp/WEB-INF/web.xml.wildfly" tofile="target/examples/wildfly-demo/product-app/src/main/webapp/WEB-INF/web.xml"/>
|
||||
<move file="target/examples/wildfly-demo/product-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml.wildfly" tofile="target/examples/wildfly-demo/product-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml"/>
|
||||
<move file="target/examples/wildfly-demo/database-service/src/main/webapp/WEB-INF/web.xml.wildfly" tofile="target/examples/wildfly-demo/database-service/src/main/webapp/WEB-INF/web.xml"/>
|
||||
<move file="target/examples/wildfly-demo/database-service/src/main/webapp/WEB-INF/jboss-deployment-structure.xml.wildfly" tofile="target/examples/wildfly-demo/database-service/src/main/webapp/WEB-INF/jboss-deployment-structure.xml"/>
|
||||
<move file="target/examples/wildfly-demo/third-party/src/main/webapp/WEB-INF/web.xml.wildfly" tofile="target/examples/wildfly-demo/third-party/src/main/webapp/WEB-INF/web.xml"/>
|
||||
<move file="target/examples/wildfly-demo/third-party-cdi/src/main/webapp/WEB-INF/web.xml.wildfly" tofile="target/examples/wildfly-demo/third-party-cdi/src/main/webapp/WEB-INF/web.xml"/>
|
||||
<copy todir="target/examples/unconfigured-demo" overwrite="true">
|
||||
<fileset dir="../../examples/demo-template">
|
||||
<exclude name="**/*.wildfly"/>
|
||||
|
@ -41,6 +19,9 @@
|
|||
<exclude name="**/*.iml"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<move file="target/examples/unconfigured-demo/customer-app/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/customer-app/src/main/webapp/WEB-INF/web.xml"/>
|
||||
<move file="target/examples/unconfigured-demo/product-app/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/product-app/src/main/webapp/WEB-INF/web.xml"/>
|
||||
<move file="target/examples/unconfigured-demo/database-service/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/database-service/src/main/webapp/WEB-INF/web.xml"/>
|
||||
<copy todir="target/examples/themes" overwrite="true">
|
||||
<fileset dir="../../examples/themes"/>
|
||||
</copy>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<module name="org.jboss.as.web"/>
|
||||
<module name="org.picketbox"/>
|
||||
<module name="org.keycloak.keycloak-adapter-core"/>
|
||||
<module name="org.keycloak.keycloak-core" export="true"/>
|
||||
<module name="org.keycloak.keycloak-core"/>
|
||||
</dependencies>
|
||||
|
||||
</module>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<module name="io.undertow.core"/>
|
||||
<module name="io.undertow.servlet"/>
|
||||
<module name="org.keycloak.keycloak-adapter-core"/>
|
||||
<module name="org.keycloak.keycloak-core" export="true"/>
|
||||
<module name="org.keycloak.keycloak-core"/>
|
||||
</dependencies>
|
||||
|
||||
</module>
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
<jboss-deployment-structure>
|
||||
<deployment>
|
||||
<dependencies>
|
||||
<!-- The keycloak-as7-adapter is required -->
|
||||
<module name="org.keycloak.keycloak-as7-adapter"/>
|
||||
<!-- the Demo code uses classes in these modules. These are optional to import if you are not using
|
||||
Apache Http Client or the HttpClientBuilder that comes with the adapter core -->
|
||||
<module name="org.apache.httpcomponents" />
|
||||
<module name="org.keycloak.keycloak-adapter-core"/>
|
||||
</dependencies>
|
||||
</deployment>
|
||||
</jboss-deployment-structure>
|
|
@ -1,12 +0,0 @@
|
|||
<jboss-deployment-structure>
|
||||
<deployment>
|
||||
<dependencies>
|
||||
<!-- The keycloak-undertow-adapter is required -->
|
||||
<module name="org.keycloak.keycloak-undertow-adapter" services="import"/>
|
||||
<!-- the Demo code uses classes in these modules. These are optional to import if you are not using
|
||||
Apache Http Client or the HttpClientBuilder that comes with the adapter core -->
|
||||
<module name="org.apache.httpcomponents" />
|
||||
<module name="org.keycloak.keycloak-adapter-core"/>
|
||||
</dependencies>
|
||||
</deployment>
|
||||
</jboss-deployment-structure>
|
|
@ -1,5 +0,0 @@
|
|||
<jboss-web>
|
||||
<valve>
|
||||
<class-name>org.keycloak.adapters.as7.KeycloakAuthenticatorValve</class-name>
|
||||
</valve>
|
||||
</jboss-web>
|
|
@ -36,7 +36,7 @@
|
|||
</security-constraint> -->
|
||||
|
||||
<login-config>
|
||||
<auth-method>BASIC</auth-method>
|
||||
<auth-method>KEYCLOAK</auth-method>
|
||||
<realm-name>demo</realm-name>
|
||||
</login-config>
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
</security-constraint> -->
|
||||
|
||||
<login-config>
|
||||
<auth-method>KEYCLOAK</auth-method>
|
||||
<realm-name>commerce</realm-name>
|
||||
<auth-method>BASIC</auth-method>
|
||||
<realm-name>demo</realm-name>
|
||||
</login-config>
|
||||
|
||||
<security-role>
|
|
@ -1,9 +0,0 @@
|
|||
<jboss-deployment-structure>
|
||||
<deployment>
|
||||
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
|
||||
<dependencies>
|
||||
<!-- The keycloak-as7-adapter is required -->
|
||||
<module name="org.keycloak.keycloak-as7-adapter"/>
|
||||
</dependencies>
|
||||
</deployment>
|
||||
</jboss-deployment-structure>
|
|
@ -1,8 +0,0 @@
|
|||
<jboss-deployment-structure>
|
||||
<deployment>
|
||||
<dependencies>
|
||||
<!-- The keycloak-undertow-adapter is required -->
|
||||
<module name="org.keycloak.keycloak-undertow-adapter" services="import"/>
|
||||
</dependencies>
|
||||
</deployment>
|
||||
</jboss-deployment-structure>
|
|
@ -1,5 +0,0 @@
|
|||
<jboss-web>
|
||||
<valve>
|
||||
<class-name>org.keycloak.adapters.as7.KeycloakAuthenticatorValve</class-name>
|
||||
</valve>
|
||||
</jboss-web>
|
|
@ -19,7 +19,7 @@
|
|||
</security-constraint>
|
||||
|
||||
<login-config>
|
||||
<auth-method>BASIC</auth-method>
|
||||
<auth-method>KEYCLOAK</auth-method>
|
||||
<realm-name>demo</realm-name>
|
||||
</login-config>
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
</security-constraint>
|
||||
|
||||
<login-config>
|
||||
<auth-method>KEYCLOAK</auth-method>
|
||||
<realm-name>commerce</realm-name>
|
||||
<auth-method>BASIC</auth-method>
|
||||
<realm-name>demo</realm-name>
|
||||
</login-config>
|
||||
|
||||
<security-role>
|
|
@ -1,12 +1,9 @@
|
|||
<jboss-deployment-structure>
|
||||
<deployment>
|
||||
<dependencies>
|
||||
<!-- The keycloak-as7-adapter is required -->
|
||||
<module name="org.keycloak.keycloak-as7-adapter"/>
|
||||
<!-- the Demo code uses classes in these modules. These are optional to import if you are not using
|
||||
Apache Http Client or the HttpClientBuilder that comes with the adapter core -->
|
||||
<module name="org.apache.httpcomponents" />
|
||||
<module name="org.keycloak.keycloak-adapter-core"/>
|
||||
</dependencies>
|
||||
</deployment>
|
||||
</jboss-deployment-structure>
|
|
@ -1,12 +0,0 @@
|
|||
<jboss-deployment-structure>
|
||||
<deployment>
|
||||
<dependencies>
|
||||
<!-- The keycloak-undertow-adapter is required -->
|
||||
<module name="org.keycloak.keycloak-undertow-adapter" services="import"/>
|
||||
<!-- the Demo code uses classes in these modules. These are optional to import if you are not using
|
||||
Apache Http Client or the HttpClientBuilder that comes with the adapter core -->
|
||||
<module name="org.apache.httpcomponents" />
|
||||
<module name="org.keycloak.keycloak-adapter-core"/>
|
||||
</dependencies>
|
||||
</deployment>
|
||||
</jboss-deployment-structure>
|
|
@ -1,5 +0,0 @@
|
|||
<jboss-web>
|
||||
<valve>
|
||||
<class-name>org.keycloak.adapters.as7.KeycloakAuthenticatorValve</class-name>
|
||||
</valve>
|
||||
</jboss-web>
|
|
@ -36,7 +36,7 @@
|
|||
-->
|
||||
|
||||
<login-config>
|
||||
<auth-method>BASIC</auth-method>
|
||||
<auth-method>KEYCLOAK</auth-method>
|
||||
<realm-name>demo</realm-name>
|
||||
</login-config>
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
-->
|
||||
|
||||
<login-config>
|
||||
<auth-method>KEYCLOAK</auth-method>
|
||||
<realm-name>commerce</realm-name>
|
||||
<auth-method>BASIC</auth-method>
|
||||
<realm-name>demo</realm-name>
|
||||
</login-config>
|
||||
|
||||
<security-role>
|
20
examples/demo-template/subsystem-config.xml
Executable file
20
examples/demo-template/subsystem-config.xml
Executable file
|
@ -0,0 +1,20 @@
|
|||
<!-- works with keycloak.json that comes with example -->
|
||||
<subsystem xmlns="urn:jboss:domain:keycloak:1.0">
|
||||
<realm name="demo">
|
||||
<realm-public-key>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB</realm-public-key>
|
||||
<auth-server-url>http://localhost:8080/auth</auth-server-url>
|
||||
<ssl-not-required>true</ssl-not-required>
|
||||
<secure-deployment name="customer-portal.war">
|
||||
<resource>customer-portal</resource>
|
||||
<credential name="password">password</credential>
|
||||
</secure-deployment>
|
||||
<secure-deployment name="product-portal.war">
|
||||
<resource>product-portal</resource>
|
||||
<credential name="password">password</credential>
|
||||
</secure-deployment>
|
||||
<secure-deployment name="database.war">
|
||||
<resource>database</resource>
|
||||
<credential name="password">password</credential>
|
||||
</secure-deployment>
|
||||
</realm>
|
||||
</subsystem>
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<module-name>oauth-client-cdi</module-name>
|
||||
|
||||
<!--
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</web-resource-collection>
|
||||
<user-data-constraint>
|
||||
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
|
||||
</user-data-constraint>
|
||||
</security-constraint>
|
||||
-->
|
||||
|
||||
</web-app>
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<module-name>oauth-client</module-name>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.keycloak.example.oauth.Bootstrap</listener-class>
|
||||
</listener>
|
||||
<!--
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</web-resource-collection>
|
||||
<user-data-constraint>
|
||||
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
|
||||
</user-data-constraint>
|
||||
</security-constraint>
|
||||
-->
|
||||
|
||||
</web-app>
|
|
@ -14,6 +14,7 @@ import org.keycloak.util.JsonSerialization;
|
|||
import org.keycloak.util.KeycloakUriBuilder;
|
||||
import org.keycloak.util.StreamUtil;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
@ -77,7 +78,18 @@ public class TokenGrantRequest {
|
|||
}
|
||||
InputStream is = entity.getContent();
|
||||
try {
|
||||
return JsonSerialization.readValue(is, AccessTokenResponse.class);
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
int c;
|
||||
while ((c = is.read()) != -1) {
|
||||
os.write(c);
|
||||
}
|
||||
byte[] bytes = os.toByteArray();
|
||||
String json = new String(bytes);
|
||||
try {
|
||||
return JsonSerialization.readValue(json, AccessTokenResponse.class);
|
||||
} catch (IOException e) {
|
||||
throw new IOException(json, e);
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
|
|
|
@ -59,6 +59,18 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||
if (service.isKeycloakDeployment(deploymentName)) {
|
||||
|
||||
addKeycloakAuthData(phaseContext, deploymentName, service);
|
||||
return;
|
||||
}
|
||||
|
||||
// else check to see if KEYCLOAK is specified as login config
|
||||
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
|
||||
if (warMetaData == null) return;
|
||||
JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData();
|
||||
if (webMetaData == null) return;
|
||||
|
||||
LoginConfigMetaData loginConfig = webMetaData.getLoginConfig();
|
||||
if (loginConfig != null && loginConfig.getAuthMethod().equalsIgnoreCase("KEYCLOAK")) {
|
||||
addValve(webMetaData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,6 +84,18 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||
webMetaData = new JBossWebMetaData();
|
||||
warMetaData.setMergedJBossWebMetaData(webMetaData);
|
||||
}
|
||||
addValve(webMetaData);
|
||||
|
||||
LoginConfigMetaData loginConfig = webMetaData.getLoginConfig();
|
||||
if (loginConfig == null) {
|
||||
loginConfig = new LoginConfigMetaData();
|
||||
webMetaData.setLoginConfig(loginConfig);
|
||||
}
|
||||
loginConfig.setAuthMethod("KEYCLOAK");
|
||||
loginConfig.setRealmName(service.getRealmName(deploymentName));
|
||||
}
|
||||
|
||||
private void addValve(JBossWebMetaData webMetaData) {
|
||||
List<ValveMetaData> valves = webMetaData.getValves();
|
||||
if (valves == null) {
|
||||
valves = new ArrayList<ValveMetaData>(1);
|
||||
|
@ -80,19 +104,8 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
|
|||
ValveMetaData valve = new ValveMetaData();
|
||||
valve.setValveClass(KeycloakAuthenticatorValve.class.getName());
|
||||
valve.setModule("org.keycloak.keycloak-as7-adapter");
|
||||
log.info("******* adding Keycloak valve to: " + deploymentName);
|
||||
//log.info("******* adding Keycloak valve to: " + deploymentName);
|
||||
valves.add(valve);
|
||||
|
||||
/*
|
||||
LoginConfigMetaData loginConfig = webMetaData.getLoginConfig();
|
||||
if (loginConfig == null) {
|
||||
loginConfig = new LoginConfigMetaData();
|
||||
webMetaData.setLoginConfig(loginConfig);
|
||||
}
|
||||
loginConfig.setAuthMethod("KEYCLOAK");
|
||||
loginConfig.setRealmName(service.getRealmName(deploymentName));
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
private void addJSONData(String json, WarMetaData warMetaData) {
|
||||
|
|
|
@ -36,16 +36,14 @@ public class KeycloakDependencyProcessor implements DeploymentUnitProcessor {
|
|||
|
||||
private static final ModuleIdentifier KEYCLOAK_AS7_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-as7-adapter");
|
||||
private static final ModuleIdentifier KEYCLOAK_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-adapter-core");
|
||||
private static final ModuleIdentifier APACHE_HTTPCOMPONENTS = ModuleIdentifier.create("org.apache.httpcomponents");
|
||||
private static final ModuleIdentifier KEYCLOAK_CORE = ModuleIdentifier.create("org.keycloak.keycloak-core");
|
||||
//private static final ModuleIdentifier APACHE_HTTPCOMPONENTS = ModuleIdentifier.create("org.apache.httpcomponents");
|
||||
|
||||
@Override
|
||||
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
|
||||
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
|
||||
|
||||
KeycloakAdapterConfigService service = KeycloakAdapterConfigService.find(phaseContext.getServiceRegistry());
|
||||
if (service.isKeycloakDeployment(deploymentUnit.getName())) {
|
||||
addModules(deploymentUnit);
|
||||
}
|
||||
addModules(deploymentUnit);
|
||||
}
|
||||
|
||||
private void addModules(DeploymentUnit deploymentUnit) {
|
||||
|
@ -54,7 +52,8 @@ public class KeycloakDependencyProcessor implements DeploymentUnitProcessor {
|
|||
|
||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_AS7_ADAPTER, false, false, true, false));
|
||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
|
||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, APACHE_HTTPCOMPONENTS, false, false, true, false));
|
||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE, false, false, false, false));
|
||||
//moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, APACHE_HTTPCOMPONENTS, false, false, true, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -175,7 +175,8 @@ public class KeycloakAuthenticatorValve extends FormAuthenticator implements Lif
|
|||
}
|
||||
|
||||
protected boolean bearer(boolean challenge, Request request, HttpServletResponse response) throws LoginException, IOException {
|
||||
CatalinaBearerTokenAuthenticator bearer = new CatalinaBearerTokenAuthenticator(realmConfiguration.getMetadata(), challenge, adapterConfig.isUseResourceRoleMappings());
|
||||
boolean useResourceRoleMappings = adapterConfig.isUseResourceRoleMappings();
|
||||
CatalinaBearerTokenAuthenticator bearer = new CatalinaBearerTokenAuthenticator(resourceMetadata, challenge, useResourceRoleMappings);
|
||||
if (bearer.login(request, response)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ public class OAuthAuthenticator {
|
|||
return challenge(StatusCodes.FORBIDDEN);
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("failed to turn code into token");
|
||||
log.error("failed to turn code into token", e);
|
||||
return challenge(StatusCodes.FORBIDDEN);
|
||||
}
|
||||
|
||||
|
|
14
integration/wildfly-subsystem/src/main/java/org/keycloak/subsystem/extension/KeycloakDependencyProcessor.java
Normal file → Executable file
14
integration/wildfly-subsystem/src/main/java/org/keycloak/subsystem/extension/KeycloakDependencyProcessor.java
Normal file → Executable file
|
@ -24,9 +24,11 @@ import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
|
|||
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
|
||||
import org.jboss.as.server.deployment.module.ModuleDependency;
|
||||
import org.jboss.as.server.deployment.module.ModuleSpecification;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.modules.Module;
|
||||
import org.jboss.modules.ModuleIdentifier;
|
||||
import org.jboss.modules.ModuleLoader;
|
||||
import org.keycloak.subsystem.logging.KeycloakLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -36,16 +38,13 @@ public class KeycloakDependencyProcessor implements DeploymentUnitProcessor {
|
|||
|
||||
private static final ModuleIdentifier KEYCLOAK_UNDERTOW_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-undertow-adapter");
|
||||
private static final ModuleIdentifier KEYCLOAK_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-adapter-core");
|
||||
private static final ModuleIdentifier APACHE_HTTPCOMPONENTS = ModuleIdentifier.create("org.apache.httpcomponents");
|
||||
private static final ModuleIdentifier KEYCLOAK_CORE = ModuleIdentifier.create("org.keycloak.keycloak-core");
|
||||
//private static final ModuleIdentifier APACHE_HTTPCOMPONENTS = ModuleIdentifier.create("org.apache.httpcomponents");
|
||||
|
||||
@Override
|
||||
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
|
||||
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
|
||||
|
||||
KeycloakAdapterConfigService service = KeycloakAdapterConfigService.find(phaseContext.getServiceRegistry());
|
||||
if (service.isKeycloakDeployment(deploymentUnit.getName())) {
|
||||
addModules(deploymentUnit);
|
||||
}
|
||||
addModules(deploymentUnit);
|
||||
}
|
||||
|
||||
private void addModules(DeploymentUnit deploymentUnit) {
|
||||
|
@ -54,7 +53,8 @@ public class KeycloakDependencyProcessor implements DeploymentUnitProcessor {
|
|||
|
||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_UNDERTOW_ADAPTER, false, false, true, false));
|
||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
|
||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, APACHE_HTTPCOMPONENTS, false, false, true, false));
|
||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE, false, false, false, false));
|
||||
//moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, APACHE_HTTPCOMPONENTS, false, false, true, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
<deployment>
|
||||
<exclusions>
|
||||
|
||||
<!-- Exclude keycloak modules -->
|
||||
<module name="org.keycloak.keycloak-core" />
|
||||
<module name="org.keycloak.keycloak-adapter-core" />
|
||||
<module name="org.keycloak.keycloak-undertow-adapter" />
|
||||
<module name="org.keycloak.keycloak-as7-adapter" />
|
||||
|
||||
<!-- Exclude Version cxf of JBOSS -->
|
||||
<module name="org.apache.cxf" />
|
||||
<!-- Exclude JAVA EE of JBOSS (javax.ws..) => Add dependency javax.annotation -->
|
||||
|
|
Loading…
Reference in a new issue