[KEYCLOAK-14953] keycloak oidc/elytron adapter galleon-pack prototype

This commit is contained in:
JF Denise 2020-04-09 15:19:10 +02:00 committed by Stian Thorgersen
parent b75ad2fbd8
commit 6a5c1defe1
9 changed files with 516 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* Copyright 2020 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -37,7 +37,7 @@ import org.jboss.modules.ModuleLoader;
*/
public abstract class KeycloakDependencyProcessor implements DeploymentUnitProcessor {
private static final ModuleIdentifier KEYCLOAK_JBOSS_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-jboss-adapter-core");
private static final ModuleIdentifier KEYCLOAK_JBOSS_CORE_ADAPTER = KeycloakSubsystemDefinition.KEYCLOAK_JBOSS_CORE_ADAPTER;
private static final ModuleIdentifier KEYCLOAK_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-adapter-core");
private static final ModuleIdentifier KEYCLOAK_CORE = ModuleIdentifier.create("org.keycloak.keycloak-core");
private static final ModuleIdentifier KEYCLOAK_COMMON = ModuleIdentifier.create("org.keycloak.keycloak-common");

View file

@ -1,5 +1,5 @@
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* Copyright 2020 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -21,6 +21,8 @@ import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.operations.common.GenericSubsystemDescribeHandler;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.RuntimePackageDependency;
import org.jboss.modules.ModuleIdentifier;
/**
* Definition of subsystem=keycloak.
@ -28,6 +30,9 @@ import org.jboss.as.controller.registry.ManagementResourceRegistration;
* @author Stan Silvert ssilvert@redhat.com (C) 2013 Red Hat Inc.
*/
public class KeycloakSubsystemDefinition extends SimpleResourceDefinition {
static final ModuleIdentifier KEYCLOAK_JBOSS_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-jboss-adapter-core");
protected KeycloakSubsystemDefinition() {
super(KeycloakExtension.SUBSYSTEM_PATH,
KeycloakExtension.getResourceDescriptionResolver("subsystem"),
@ -42,4 +47,10 @@ public class KeycloakSubsystemDefinition extends SimpleResourceDefinition {
resourceRegistration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
}
@Override
public void registerAdditionalRuntimePackages(ManagementResourceRegistration resourceRegistration) {
// This module is required by deployment but not referenced by JBoss modules
resourceRegistration.registerAdditionalRuntimePackages(
RuntimePackageDependency.required(KEYCLOAK_JBOSS_CORE_ADAPTER.getName()));
}
}

View file

@ -0,0 +1,309 @@
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.keycloak</groupId>
<artifactId>galleon-feature-packs-parent</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>${galleon-adapter-group-id}</groupId>
<artifactId>keycloak-adapter-galleon-pack</artifactId>
<name>Keycloak Galleon Feature Pack: Adapter</name>
<packaging>pom</packaging>
<properties>
<feature-pack.resources.directory>${basedir}/../../feature-packs/adapter-feature-pack/src/main/resources</feature-pack.resources.directory>
<version.org.wildfly.galleon-plugins>4.2.6.Final</version.org.wildfly.galleon-plugins>
<xmlFileSource>${feature-pack.resources.directory}/licenses/${product.slot}/licenses.xml</xmlFileSource>
<outputDirectory>${basedir}/target/resources/packages/licenses/content/docs/licenses-${product.slot}</outputDirectory>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-common</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-adapter-core</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-jboss-adapter-core</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wildfly-subsystem</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wildfly-adapter</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wildfly-elytron-oidc-adapter</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-adapter-spi</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-undertow-adapter-spi</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-undertow-adapter</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<!-- Authorization -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-authz-client</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/resources</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-feature-pack-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/resources</outputDirectory>
<resources>
<resource>
<directory>${feature-pack.resources.directory}</directory>
<includes>
<include>content/**</include>
<include>modules/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wildfly.galleon-plugins</groupId>
<artifactId>wildfly-galleon-maven-plugin</artifactId>
<version>${version.org.wildfly.galleon-plugins}</version>
<dependencies>
<!--
feature-spec-gen uses wildfly-embedded to generate the feature specs, hence the designated
wildfly-embedded version must match the pack one
-->
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-embedded</artifactId>
<version>${version.org.wildfly.core}</version>
</dependency>
<!-- If you add a dependency on wildfly-embedded you need to bring your own transitives -->
<dependency>
<groupId>org.wildfly.common</groupId>
<artifactId>wildfly-common</artifactId>
<version>${version.org.wildfly.common}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>keycloak-adapter-galleon-pack-build</id>
<goals>
<goal>build-feature-pack</goal>
</goals>
<phase>compile</phase>
<configuration>
<fork-embedded>false</fork-embedded>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-distribution-licenses-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>community</id>
<activation>
<property>
<name>!product</name>
</property>
</activation>
<properties>
<galleon-adapter-group-id>org.keycloak</galleon-adapter-group-id>
<version.org.wildfly>20.0.0.Final</version.org.wildfly>
<version.org.wildfly.core>12.0.0.Final</version.org.wildfly.core>
<version.org.wildfly.common>1.5.1.Final</version.org.wildfly.common>
</properties>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ee-galleon-pack</artifactId>
<version>${version.org.wildfly}</version>
<type>zip</type>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>product</id>
<activation>
<property>
<name>product</name>
</property>
</activation>
<properties>
<galleon-adapter-group-id>org.jboss.sso</galleon-adapter-group-id>
<version.org.jboss.eap>7.3.2.GA-redhat-SNAPSHOT</version.org.jboss.eap>
<version.org.wildfly.core>10.1.11.Final-redhat-SNAPSHOT</version.org.wildfly.core>
<version.org.wildfly.common>1.5.1.Final-redhat-00001</version.org.wildfly.common>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.eap</groupId>
<artifactId>wildfly-ee-galleon-pack</artifactId>
<version>${version.org.jboss.eap}</version>
<type>zip</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.galleon-plugins</groupId>
<artifactId>wildfly-galleon-maven-plugin</artifactId>
<configuration>
<config-file>wildfly-feature-pack-build-eap.xml</config-file>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" ?>
<layer-spec xmlns="urn:jboss:galleon:layer-spec:1.0" name="keycloak-elytron-oidc">
<dependencies>
<layer name="elytron"/>
</dependencies>
<feature spec="subsystem.keycloak"/>
<feature spec="subsystem.elytron.custom-realm">
<param name="custom-realm" value="KeycloakOIDCRealm"/>
<param name="class-name" value="org.keycloak.adapters.elytron.KeycloakSecurityRealm"/>
<param name="module" value="org.keycloak.keycloak-wildfly-elytron-oidc-adapter"/>
</feature>
<feature spec="subsystem.elytron.security-domain">
<param name="security-domain" value="KeycloakDomain"/>
<param name="default-realm" value="KeycloakOIDCRealm"/>
<param name="permission-mapper" value="default-permission-mapper"/>
<param name="security-event-listener" value="local-audit"/>
<param name="realms" value="[{realm=KeycloakOIDCRealm}]"/>
</feature>
<feature spec="subsystem.elytron.constant-realm-mapper">
<param name="constant-realm-mapper" value="keycloak-oidc-realm-mapper"/>
<param name="realm-name" value="KeycloakOIDCRealm"/>
</feature>
<feature spec="subsystem.elytron.service-loader-http-server-mechanism-factory">
<param name="service-loader-http-server-mechanism-factory" value="keycloak-oidc-http-server-mechanism-factory"/>
<param name="module" value="org.keycloak.keycloak-wildfly-elytron-oidc-adapter"/>
</feature>
<feature spec="subsystem.elytron.aggregate-http-server-mechanism-factory">
<param name="aggregate-http-server-mechanism-factory" value="keycloak-http-server-mechanism-factory"/>
<param name="http-server-mechanism-factories" value="[keycloak-oidc-http-server-mechanism-factory, global]"/>
</feature>
<feature spec="subsystem.elytron.http-authentication-factory">
<param name="http-authentication-factory" value="keycloak-http-authentication"/>
<param name="http-server-mechanism-factory" value="keycloak-http-server-mechanism-factory"/>
<param name="security-domain" value="KeycloakDomain"/>
<param name="mechanism-configurations" value="[{mechanism-name=KEYCLOAK,mechanism-realm-configurations=[{realm-name=KeycloakOIDCRealm,realm-mapper=keycloak-oidc-realm-mapper}]}]"/>
</feature>
<feature spec="subsystem.undertow">
<feature spec="subsystem.undertow.application-security-domain">
<param name="application-security-domain" value="other" />
<unset param="security-domain"/>
<param name="http-authentication-factory" value="keycloak-http-authentication"/>
</feature>
</feature>
</layer-spec>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" ?>
<package-spec xmlns="urn:jboss:galleon:package:2.0" name="licenses">
</package-spec>

View file

@ -0,0 +1,54 @@
<!--
~ Copyright 2020 Red Hat, Inc.
~
~ 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.
-->
<build xmlns="urn:wildfly:feature-pack-build:3.0" producer="org.jboss.sso:keycloak-adapter-galleon-pack">
<transitive>
<dependency group-id="org.wildfly.core" artifact-id="wildfly-core-galleon-pack">
<name>org.wildfly.core:wildfly-core-galleon-pack</name>
<packages inherit="false">
<exclude name="product.conf"/>
</packages>
<default-configs inherit="false"/>
</dependency>
<dependency group-id="org.jboss.eap" artifact-id="wildfly-servlet-galleon-pack">
<name>org.jboss.eap:wildfly-servlet-galleon-pack</name>
<packages inherit="false">
<exclude name="product.conf"/>
</packages>
<default-configs inherit="false"/>
</dependency>
</transitive>
<dependencies>
<dependency group-id="org.jboss.eap" artifact-id="wildfly-ee-galleon-pack">
<name>org.jboss.eap:wildfly-ee-galleon-pack</name>
<packages inherit="false">
<exclude name="product.conf"/>
</packages>
<default-configs inherit="false"/>
</dependency>
</dependencies>
<default-packages>
<package name="modules.all"/>
<package name="licenses"/>
</default-packages>
<generate-feature-specs>
<extensions>
<standalone>
<extension>org.keycloak.keycloak-adapter-subsystem</extension>
</standalone>
</extensions>
</generate-feature-specs>
</build>

View file

@ -0,0 +1,54 @@
<!--
~ Copyright 2020 Red Hat, Inc.
~
~ 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.
-->
<build xmlns="urn:wildfly:feature-pack-build:3.0" producer="org.keycloak:keycloak-galleon-pack">
<transitive>
<dependency group-id="org.wildfly.core" artifact-id="wildfly-core-galleon-pack">
<name>org.wildfly.core:wildfly-core-galleon-pack</name>
<packages inherit="false">
<exclude name="product.conf"/>
</packages>
<default-configs inherit="false"/>
</dependency>
<dependency group-id="org.wildfly" artifact-id="wildfly-servlet-galleon-pack">
<name>org.wildfly:wildfly-servlet-galleon-pack</name>
<packages inherit="false">
<exclude name="product.conf"/>
</packages>
<default-configs inherit="false"/>
</dependency>
</transitive>
<dependencies>
<dependency group-id="org.wildfly" artifact-id="wildfly-ee-galleon-pack">
<name>org.wildfly:wildfly-ee-galleon-pack</name>
<packages inherit="false">
<exclude name="product.conf"/>
</packages>
<default-configs inherit="false"/>
</dependency>
</dependencies>
<default-packages>
<package name="modules.all"/>
<package name="licenses"/>
</default-packages>
<generate-feature-specs>
<extensions>
<standalone>
<extension>org.keycloak.keycloak-adapter-subsystem</extension>
</standalone>
</extensions>
</generate-feature-specs>
</build>

View file

@ -0,0 +1,36 @@
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>keycloak-distribution-parent</artifactId>
<groupId>org.keycloak</groupId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<name>Feature Pack Builds</name>
<description/>
<modelVersion>4.0.0</modelVersion>
<artifactId>galleon-feature-packs-parent</artifactId>
<packaging>pom</packaging>
<modules>
<module>adapter-galleon-pack</module>
</modules>
</project>

View file

@ -39,6 +39,7 @@
<module>adapters</module>
<module>saml-adapters</module>
<module>feature-packs</module>
<module>galleon-feature-packs</module>
<module>licenses-common</module>
<module>maven-plugins</module>
<module>server-dist</module>