SAML Adapter fix for EAP8 and WF29

Signed-off-by: Peter Skopek <pskopek@redhat.com>
This commit is contained in:
Peter Skopek 2023-08-29 09:51:12 +02:00 committed by Alexander Schwartz
parent f086e008dc
commit ef272f7668
12 changed files with 133 additions and 47 deletions

View file

@ -64,7 +64,7 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-web-common</artifactId> <artifactId>wildfly-web-common</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View file

@ -36,7 +36,7 @@ abstract class AbstractAdapterConfigurationAddHandler extends AbstractAddStepHan
private final boolean elytronEnabled; private final boolean elytronEnabled;
AbstractAdapterConfigurationAddHandler(RuntimeCapability<Void> runtimeCapability, List<SimpleAttributeDefinition> attributes) { AbstractAdapterConfigurationAddHandler(RuntimeCapability<Void> runtimeCapability, List<SimpleAttributeDefinition> attributes) {
super(runtimeCapability, attributes); super(attributes);
elytronEnabled = runtimeCapability != null; elytronEnabled = runtimeCapability != null;
} }

View file

@ -118,7 +118,7 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-web-common</artifactId> <artifactId>wildfly-web-common</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View file

@ -64,7 +64,7 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-web-common</artifactId> <artifactId>wildfly-web-common</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View file

@ -498,7 +498,7 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
writer.writeAttribute(Constants.XML.ENTITY_ID, sp.getName()); writer.writeAttribute(Constants.XML.ENTITY_ID, sp.getName());
ModelNode spAttributes = sp.getValue(); ModelNode spAttributes = sp.getValue();
for (SimpleAttributeDefinition attr : ServiceProviderDefinition.ATTRIBUTES) { for (SimpleAttributeDefinition attr : ServiceProviderDefinition.ATTRIBUTES) {
attr.getAttributeMarshaller().marshallAsAttribute(attr, spAttributes, false, writer); attr.marshallAsAttribute(spAttributes, false, writer);
} }
writeKeys(writer, spAttributes.get(Constants.Model.KEY)); writeKeys(writer, spAttributes.get(Constants.Model.KEY));
writePrincipalNameMapping(writer, spAttributes); writePrincipalNameMapping(writer, spAttributes);
@ -521,7 +521,7 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
ModelNode idpAttributes = idp.getValue(); ModelNode idpAttributes = idp.getValue();
for (SimpleAttributeDefinition attr : IdentityProviderDefinition.ATTRIBUTES) { for (SimpleAttributeDefinition attr : IdentityProviderDefinition.ATTRIBUTES) {
attr.getAttributeMarshaller().marshallAsAttribute(attr, idpAttributes, false, writer); attr.marshallAsAttribute(idpAttributes, false, writer);
} }
writeSingleSignOn(writer, idpAttributes.get(Constants.Model.SINGLE_SIGN_ON)); writeSingleSignOn(writer, idpAttributes.get(Constants.Model.SINGLE_SIGN_ON));
@ -539,7 +539,7 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
} }
writer.writeStartElement(Constants.XML.SINGLE_SIGN_ON); writer.writeStartElement(Constants.XML.SINGLE_SIGN_ON);
for (SimpleAttributeDefinition attr : SingleSignOnDefinition.ATTRIBUTES) { for (SimpleAttributeDefinition attr : SingleSignOnDefinition.ATTRIBUTES) {
attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); attr.marshallAsAttribute(model, false, writer);
} }
writer.writeEndElement(); writer.writeEndElement();
} }
@ -550,7 +550,7 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
} }
writer.writeStartElement(Constants.XML.SINGLE_LOGOUT); writer.writeStartElement(Constants.XML.SINGLE_LOGOUT);
for (SimpleAttributeDefinition attr : SingleLogoutDefinition.ATTRIBUTES) { for (SimpleAttributeDefinition attr : SingleLogoutDefinition.ATTRIBUTES) {
attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); attr.marshallAsAttribute(model, false, writer);
} }
writer.writeEndElement(); writer.writeEndElement();
} }
@ -569,10 +569,10 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
ModelNode keyAttributes = key.getValue(); ModelNode keyAttributes = key.getValue();
for (SimpleAttributeDefinition attr : KeyDefinition.ATTRIBUTES) { for (SimpleAttributeDefinition attr : KeyDefinition.ATTRIBUTES) {
attr.getAttributeMarshaller().marshallAsAttribute(attr, keyAttributes, false, writer); attr.marshallAsAttribute(keyAttributes, false, writer);
} }
for (SimpleAttributeDefinition attr : KeyDefinition.ELEMENTS) { for (SimpleAttributeDefinition attr : KeyDefinition.ELEMENTS) {
attr.getAttributeMarshaller().marshallAsElement(attr, keyAttributes, false, writer); attr.marshallAsElement(keyAttributes, false, writer);
} }
writeKeyStore(writer, keyAttributes.get(Constants.Model.KEY_STORE)); writeKeyStore(writer, keyAttributes.get(Constants.Model.KEY_STORE));
@ -599,7 +599,7 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
return; return;
} }
writer.writeStartElement(Constants.XML.ALLOWED_CLOCK_SKEW); writer.writeStartElement(Constants.XML.ALLOWED_CLOCK_SKEW);
AllowedClockSkew.ALLOWED_CLOCK_SKEW_UNIT.getAttributeMarshaller().marshallAsAttribute(AllowedClockSkew.ALLOWED_CLOCK_SKEW_UNIT, allowedClockSkew, false, writer); AllowedClockSkew.ALLOWED_CLOCK_SKEW_UNIT.marshallAsAttribute(allowedClockSkew, false, writer);
ModelNode allowedClockSkewValue = allowedClockSkew.get(Constants.Model.ALLOWED_CLOCK_SKEW_VALUE); ModelNode allowedClockSkewValue = allowedClockSkew.get(Constants.Model.ALLOWED_CLOCK_SKEW_VALUE);
char[] chars = allowedClockSkewValue.asString().toCharArray(); char[] chars = allowedClockSkewValue.asString().toCharArray();
writer.writeCharacters(chars, 0, chars.length); writer.writeCharacters(chars, 0, chars.length);
@ -612,7 +612,7 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
} }
writer.writeStartElement(Constants.XML.KEY_STORE); writer.writeStartElement(Constants.XML.KEY_STORE);
for (SimpleAttributeDefinition attr : KeyStoreDefinition.ATTRIBUTES) { for (SimpleAttributeDefinition attr : KeyStoreDefinition.ATTRIBUTES) {
attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); attr.marshallAsAttribute(model, false, writer);
} }
writePrivateKey(writer, model); writePrivateKey(writer, model);
writeCertificate(writer, model); writeCertificate(writer, model);
@ -626,7 +626,7 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
} }
writer.writeStartElement(Constants.XML.CERTIFICATE); writer.writeStartElement(Constants.XML.CERTIFICATE);
SimpleAttributeDefinition attr = KeyStoreCertificateDefinition.CERTIFICATE_ALIAS; SimpleAttributeDefinition attr = KeyStoreCertificateDefinition.CERTIFICATE_ALIAS;
attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); attr.marshallAsAttribute(model, false, writer);
writer.writeEndElement(); writer.writeEndElement();
} }
@ -639,7 +639,7 @@ class KeycloakSubsystemParser implements XMLStreamConstants, XMLElementReader<Li
} }
writer.writeStartElement(Constants.XML.PRIVATE_KEY); writer.writeStartElement(Constants.XML.PRIVATE_KEY);
for (SimpleAttributeDefinition attr : KeyStorePrivateKeyDefinition.ATTRIBUTES) { for (SimpleAttributeDefinition attr : KeyStorePrivateKeyDefinition.ATTRIBUTES) {
attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); attr.marshallAsAttribute(model, false, writer);
} }
writer.writeEndElement(); writer.writeEndElement();
} }

View file

@ -31,10 +31,6 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<wildfly.version>27.0.0.Final</wildfly.version>
<wildfly.build-tools.version>1.2.13.Final</wildfly.build-tools.version>
<wildfly.core.version>19.0.0.Final</wildfly.core.version>
<feature-pack.resources.directory>${basedir}/../../saml-adapters/wildfly-adapter/wildfly-jakarta-modules/src/main/resources</feature-pack.resources.directory> <feature-pack.resources.directory>${basedir}/../../saml-adapters/wildfly-adapter/wildfly-jakarta-modules/src/main/resources</feature-pack.resources.directory>
<version.org.wildfly.galleon-plugins>6.4.0.Final</version.org.wildfly.galleon-plugins> <version.org.wildfly.galleon-plugins>6.4.0.Final</version.org.wildfly.galleon-plugins>
<xmlFileSource>${basedir}/src/main/resources/licenses/keycloak/licenses.xml</xmlFileSource> <xmlFileSource>${basedir}/src/main/resources/licenses/keycloak/licenses.xml</xmlFileSource>
@ -185,7 +181,7 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-ee-galleon-pack</artifactId> <artifactId>wildfly-ee-galleon-pack</artifactId>
<version>${wildfly.version}</version> <version>${wildfly.version}</version>
<type>zip</type> <type>zip</type>
@ -261,4 +257,25 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>eap8-adapters</id>
<activation>
<property>
<name>eap8-adapters</name>
</property>
</activation>
<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> </project>

View file

@ -0,0 +1,38 @@
<!--
~ Copyright 2022 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.1" producer="org.keycloak:keycloak-saml-adapter-galleon-pack">
<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-saml-adapter-subsystem</extension>
</standalone>
</extensions>
</generate-feature-specs>
</build>

View file

@ -33,6 +33,11 @@
<properties> <properties>
<keycloak.provisioning.xml>server-provisioning.xml</keycloak.provisioning.xml> <keycloak.provisioning.xml>server-provisioning.xml</keycloak.provisioning.xml>
<!-- Wildfly Community Related Properties -->
<!-- EAP8 Related Properties -->
</properties> </properties>
<modules> <modules>
@ -42,7 +47,6 @@
<module>galleon-feature-packs</module> <module>galleon-feature-packs</module>
<module>licenses-common</module> <module>licenses-common</module>
<module>maven-plugins</module> <module>maven-plugins</module>
<!--<module>server-overlay</module>-->
</modules> </modules>
<repositories> <repositories>
@ -73,18 +77,6 @@
</repositories> </repositories>
<profiles> <profiles>
<profile>
<id>wildfly-dist</id>
<activation>
<property>
<name>includeWildFly</name>
</property>
</activation>
<modules>
<module>galleon-feature-packs</module>
<module>server-dist</module>
</modules>
</profile>
<profile> <profile>
<id>distribution-downloads</id> <id>distribution-downloads</id>
<modules> <modules>

View file

@ -81,7 +81,7 @@
<!-- Needed for externalizers in package "org.keycloak.models.sessions.infinispan.entities.wildfly" . <!-- Needed for externalizers in package "org.keycloak.models.sessions.infinispan.entities.wildfly" .
Hopefully can be removed once we start to use the protobuf marshalling --> Hopefully can be removed once we start to use the protobuf marshalling -->
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-clustering-infinispan-marshalling</artifactId> <artifactId>wildfly-clustering-infinispan-marshalling</artifactId>
</dependency> </dependency>

59
pom.xml
View file

@ -48,14 +48,20 @@
<project.build-time>${timestamp}</project.build-time> <project.build-time>${timestamp}</project.build-time>
<wildfly.version>27.0.1.Final</wildfly.version> <!-- Upstream WildFly Versions -->
<wildfly.build-tools.version>1.2.13.Final</wildfly.build-tools.version> <upstream.wildfly.version>27.0.1.Final</upstream.wildfly.version>
<wildfly.core.version>19.0.1.Final</wildfly.core.version> <upstream.wildfly.build-tools.version>1.2.13.Final</upstream.wildfly.build-tools.version>
<upstream.wildfly.core.version>21.1.0.Final</upstream.wildfly.core.version>
<!-- Downstream Builds WildFly Versions Override -->
<eap8.version>8.0.0.GA-redhat-00007</eap8.version> <!-- G:A = org.jboss.eap:jboss-eap-parent -->
<eap8.wildfly.version>${eap8.version}</eap8.wildfly.version>
<eap8.wildfly.core.version>21.1.0.Final</eap8.wildfly.core.version>
<eap8.wildfly.build-tools.version>1.2.13.Final</eap8.wildfly.build-tools.version>
<wildfly.jakarta.adapters>true</wildfly.jakarta.adapters> <wildfly.jakarta.adapters>true</wildfly.jakarta.adapters>
<apache.httpcomponents.fuse.version>4.5.2</apache.httpcomponents.fuse.version> <apache.httpcomponents.fuse.version>4.5.2</apache.httpcomponents.fuse.version>
<apache.httpcomponents.httpcore.fuse.version>4.4.4</apache.httpcomponents.httpcore.fuse.version> <apache.httpcomponents.httpcore.fuse.version>4.4.4</apache.httpcomponents.httpcore.fuse.version>
<ee.maven.groupId>org.wildfly</ee.maven.groupId>
<ee.maven.version>${wildfly.version}</ee.maven.version>
<jboss.as.version>7.2.0.Final</jboss.as.version> <jboss.as.version>7.2.0.Final</jboss.as.version>
<jboss.as.subsystem.test.version>7.5.22.Final-redhat-1</jboss.as.subsystem.test.version> <jboss.as.subsystem.test.version>7.5.22.Final-redhat-1</jboss.as.subsystem.test.version>
@ -198,8 +204,8 @@
<org.apache.kerby.kerby-asn1.version>2.0.3</org.apache.kerby.kerby-asn1.version> <org.apache.kerby.kerby-asn1.version>2.0.3</org.apache.kerby.kerby-asn1.version>
<!-- WildFly Galleon Build related properties --> <!-- WildFly Galleon Build related properties -->
<org.wildfly.galleon-plugins.version>5.2.7.Final</org.wildfly.galleon-plugins.version> <org.wildfly.galleon-plugins.version>6.4.2.Final</org.wildfly.galleon-plugins.version>
<org.jboss.galleon.version>4.2.8.Final</org.jboss.galleon.version> <org.jboss.galleon.version>5.1.0.Final</org.jboss.galleon.version>
<!-- Galleon --> <!-- Galleon -->
<galleon.fork.embedded>true</galleon.fork.embedded> <galleon.fork.embedded>true</galleon.fork.embedded>
@ -723,7 +729,7 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-undertow</artifactId> <artifactId>wildfly-undertow</artifactId>
<version>${wildfly.version}</version> <version>${wildfly.version}</version>
<scope>test</scope> <scope>test</scope>
@ -794,12 +800,12 @@
<version>${wildfly.core.version}</version> <version>${wildfly.core.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-web-common</artifactId> <artifactId>wildfly-web-common</artifactId>
<version>${wildfly.version}</version> <version>${wildfly.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-clustering-infinispan-marshalling</artifactId> <artifactId>wildfly-clustering-infinispan-marshalling</artifactId>
<version>${wildfly.version}</version> <version>${wildfly.version}</version>
</dependency> </dependency>
@ -1946,6 +1952,39 @@
</modules> </modules>
</profile> </profile>
<!-- Profile to activate EAP8 Adapters Build -->
<profile>
<id>eap8-adapters</id>
<activation>
<property>
<name>eap8-adapters</name>
</property>
</activation>
<properties>
<ee.maven.groupId>org.jboss.eap</ee.maven.groupId>
<ee.maven.version>${eap8.version}</ee.maven.version>
<wildfly.version>${eap8.version}</wildfly.version>
<wildfly.build-tools.version>${eap8.wildfly.build-tools.version}</wildfly.build-tools.version>
<wildfly.core.version>${eap8.wildfly.core.version}</wildfly.core.version>
</properties>
</profile>
<profile>
<id>upstream-adapters</id>
<activation>
<property>
<name>!eap8-adapters</name>
</property>
</activation>
<properties>
<ee.maven.groupId>org.wildfly</ee.maven.groupId>
<ee.maven.version>${upstream.wildfly.version}</ee.maven.version>
<wildfly.version>${upstream.wildfly.version}</wildfly.version>
<wildfly.build-tools.version>${upstream.wildfly.build-tools.version}</wildfly.build-tools.version>
<wildfly.core.version>${upstream.wildfly.core.version}</wildfly.core.version>
</properties>
</profile>
<profile> <profile>
<id>distribution</id> <id>distribution</id>
<modules> <modules>

View file

@ -30,13 +30,13 @@
<name>App Server - Wildfly</name> <name>App Server - Wildfly</name>
<properties> <properties>
<wildfly.version>23.0.2.Final</wildfly.version> <wildfly.server.version>23.0.2.Final</wildfly.server.version>
<app.server.jboss>wildfly</app.server.jboss> <app.server.jboss>wildfly</app.server.jboss>
<app.server.jboss.groupId>org.wildfly</app.server.jboss.groupId> <app.server.jboss.groupId>org.wildfly</app.server.jboss.groupId>
<app.server.jboss.artifactId>wildfly-dist</app.server.jboss.artifactId> <app.server.jboss.artifactId>wildfly-dist</app.server.jboss.artifactId>
<app.server.jboss.version>${wildfly.version}</app.server.jboss.version> <app.server.jboss.version>${wildfly.server.version}</app.server.jboss.version>
<app.server.jboss.unpacked.folder.name>wildfly-${wildfly.version}</app.server.jboss.unpacked.folder.name> <app.server.jboss.unpacked.folder.name>wildfly-${wildfly.server.version}</app.server.jboss.unpacked.folder.name>
<app.server.oidc.adapter.artifactId>keycloak-wildfly-adapter-dist</app.server.oidc.adapter.artifactId> <app.server.oidc.adapter.artifactId>keycloak-wildfly-adapter-dist</app.server.oidc.adapter.artifactId>
<app.server.saml.adapter.artifactId>keycloak-saml-wildfly-adapter-dist</app.server.saml.adapter.artifactId> <app.server.saml.adapter.artifactId>keycloak-saml-wildfly-adapter-dist</app.server.saml.adapter.artifactId>

View file

@ -258,7 +258,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-undertow</artifactId> <artifactId>wildfly-undertow</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>