From 86178570c67446381a8719491f223fd25ef5fdbe Mon Sep 17 00:00:00 2001 From: Farah Juma Date: Mon, 21 Aug 2023 16:23:08 -0400 Subject: [PATCH] Update the Keycloak SAML adapter subsystem to no longer use the AttributeDefinition#getAttributeMarshaller method Closes https://github.com/keycloak/keycloak/issues/22593 --- .../wildfly/wildfly-jakarta-subsystem/pom.xml | 5 +++++ .../saml/wildfly/wildfly-subsystem/pom.xml | 5 +++++ .../extension/KeycloakSubsystemParser.java | 20 +++++++++---------- .../saml-adapter-galleon-pack/pom.xml | 6 +++--- pom.xml | 6 ++++++ 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/adapters/saml/wildfly/wildfly-jakarta-subsystem/pom.xml b/adapters/saml/wildfly/wildfly-jakarta-subsystem/pom.xml index 5d511c8e71cd..9862cb10b6a4 100755 --- a/adapters/saml/wildfly/wildfly-jakarta-subsystem/pom.xml +++ b/adapters/saml/wildfly/wildfly-jakarta-subsystem/pom.xml @@ -140,6 +140,11 @@ true + + org.wildfly.common + wildfly-common + test + org.wildfly.core wildfly-subsystem-test-framework diff --git a/adapters/saml/wildfly/wildfly-subsystem/pom.xml b/adapters/saml/wildfly/wildfly-subsystem/pom.xml index 3b2db7d099d1..bc6c573cbf4a 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/pom.xml +++ b/adapters/saml/wildfly/wildfly-subsystem/pom.xml @@ -86,6 +86,11 @@ true + + org.wildfly.common + wildfly-common + test + org.wildfly.core wildfly-subsystem-test-framework diff --git a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java index 3876b1739fe6..4cf90c4d7645 100755 --- a/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java +++ b/adapters/saml/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeycloakSubsystemParser.java @@ -498,7 +498,7 @@ void writeSps(final XMLExtendedStreamWriter writer, final ModelNode model) throw writer.writeAttribute(Constants.XML.ENTITY_ID, sp.getName()); ModelNode spAttributes = sp.getValue(); for (SimpleAttributeDefinition attr : ServiceProviderDefinition.ATTRIBUTES) { - attr.getAttributeMarshaller().marshallAsAttribute(attr, spAttributes, false, writer); + attr.getMarshaller().marshallAsAttribute(attr, spAttributes, false, writer); } writeKeys(writer, spAttributes.get(Constants.Model.KEY)); writePrincipalNameMapping(writer, spAttributes); @@ -521,7 +521,7 @@ void writeIdentityProvider(XMLExtendedStreamWriter writer, ModelNode model) thro ModelNode idpAttributes = idp.getValue(); for (SimpleAttributeDefinition attr : IdentityProviderDefinition.ATTRIBUTES) { - attr.getAttributeMarshaller().marshallAsAttribute(attr, idpAttributes, false, writer); + attr.getMarshaller().marshallAsAttribute(attr, idpAttributes, false, writer); } writeSingleSignOn(writer, idpAttributes.get(Constants.Model.SINGLE_SIGN_ON)); @@ -539,7 +539,7 @@ void writeSingleSignOn(XMLExtendedStreamWriter writer, ModelNode model) throws X } writer.writeStartElement(Constants.XML.SINGLE_SIGN_ON); for (SimpleAttributeDefinition attr : SingleSignOnDefinition.ATTRIBUTES) { - attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); + attr.getMarshaller().marshallAsAttribute(attr, model, false, writer); } writer.writeEndElement(); } @@ -550,7 +550,7 @@ void writeSingleLogout(XMLExtendedStreamWriter writer, ModelNode model) throws X } writer.writeStartElement(Constants.XML.SINGLE_LOGOUT); for (SimpleAttributeDefinition attr : SingleLogoutDefinition.ATTRIBUTES) { - attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); + attr.getMarshaller().marshallAsAttribute(attr, model, false, writer); } writer.writeEndElement(); } @@ -569,10 +569,10 @@ void writeKeys(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStream ModelNode keyAttributes = key.getValue(); for (SimpleAttributeDefinition attr : KeyDefinition.ATTRIBUTES) { - attr.getAttributeMarshaller().marshallAsAttribute(attr, keyAttributes, false, writer); + attr.getMarshaller().marshallAsAttribute(attr, keyAttributes, false, writer); } for (SimpleAttributeDefinition attr : KeyDefinition.ELEMENTS) { - attr.getAttributeMarshaller().marshallAsElement(attr, keyAttributes, false, writer); + attr.getMarshaller().marshallAsElement(attr, keyAttributes, false, writer); } writeKeyStore(writer, keyAttributes.get(Constants.Model.KEY_STORE)); @@ -599,7 +599,7 @@ void writeAllowedClockSkew(XMLExtendedStreamWriter writer, ModelNode allowedCloc return; } 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.getMarshaller().marshallAsAttribute(AllowedClockSkew.ALLOWED_CLOCK_SKEW_UNIT, allowedClockSkew, false, writer); ModelNode allowedClockSkewValue = allowedClockSkew.get(Constants.Model.ALLOWED_CLOCK_SKEW_VALUE); char[] chars = allowedClockSkewValue.asString().toCharArray(); writer.writeCharacters(chars, 0, chars.length); @@ -612,7 +612,7 @@ void writeKeyStore(XMLExtendedStreamWriter writer, ModelNode model) throws XMLSt } writer.writeStartElement(Constants.XML.KEY_STORE); for (SimpleAttributeDefinition attr : KeyStoreDefinition.ATTRIBUTES) { - attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); + attr.getMarshaller().marshallAsAttribute(attr, model, false, writer); } writePrivateKey(writer, model); writeCertificate(writer, model); @@ -626,7 +626,7 @@ void writeCertificate(XMLExtendedStreamWriter writer, ModelNode model) throws XM } writer.writeStartElement(Constants.XML.CERTIFICATE); SimpleAttributeDefinition attr = KeyStoreCertificateDefinition.CERTIFICATE_ALIAS; - attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); + attr.getMarshaller().marshallAsAttribute(attr, model, false, writer); writer.writeEndElement(); } @@ -639,7 +639,7 @@ void writePrivateKey(XMLExtendedStreamWriter writer, ModelNode model) throws XML } writer.writeStartElement(Constants.XML.PRIVATE_KEY); for (SimpleAttributeDefinition attr : KeyStorePrivateKeyDefinition.ATTRIBUTES) { - attr.getAttributeMarshaller().marshallAsAttribute(attr, model, false, writer); + attr.getMarshaller().marshallAsAttribute(attr, model, false, writer); } writer.writeEndElement(); } diff --git a/distribution/galleon-feature-packs/saml-adapter-galleon-pack/pom.xml b/distribution/galleon-feature-packs/saml-adapter-galleon-pack/pom.xml index 6983532ed841..a7626cb21b60 100644 --- a/distribution/galleon-feature-packs/saml-adapter-galleon-pack/pom.xml +++ b/distribution/galleon-feature-packs/saml-adapter-galleon-pack/pom.xml @@ -31,9 +31,9 @@ pom - 27.0.0.Final + 29.0.0.Final 1.2.13.Final - 19.0.0.Final + 21.1.0.Final ${basedir}/../../saml-adapters/wildfly-adapter/wildfly-jakarta-modules/src/main/resources 6.4.0.Final @@ -261,4 +261,4 @@ - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index b409328af4ab..fe639956b77a 100644 --- a/pom.xml +++ b/pom.xml @@ -658,6 +658,12 @@ httpclient ${apache.httpcomponents.version} + + org.wildfly.common + wildfly-common + ${wildfly.common.version} + provided + org.wildfly.core wildfly-controller