From 3973d47bd4d2f544f69e5e5c1b332ce1b0d70121 Mon Sep 17 00:00:00 2001 From: Luca Leonardo Scorcia Date: Sun, 6 Sep 2020 18:09:13 +0200 Subject: [PATCH] KEYCLOAK-15465 SAML Identity Broker - SP metadata writer always emits AttributeConsumingService isDefault attribute The isDefault attribute is defined as optional, yet if it set to null Keycloak incorrectly emits the value isDefault="null". --- .../processing/core/saml/v2/writers/SAMLMetadataWriter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/SAMLMetadataWriter.java b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/SAMLMetadataWriter.java index 81ad6d82e4..072703b7ea 100755 --- a/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/SAMLMetadataWriter.java +++ b/saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/SAMLMetadataWriter.java @@ -351,7 +351,9 @@ public class SAMLMetadataWriter extends BaseWriter { StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ATTRIBUTE_CONSUMING_SERVICE.get(), JBossSAMLURIConstants.METADATA_NSURI.get()); - StaxUtil.writeAttribute(writer, JBossSAMLConstants.ISDEFAULT.get(), "" + attributeConsumer.isIsDefault()); + if (attributeConsumer.isIsDefault() != null) + StaxUtil.writeAttribute(writer, JBossSAMLConstants.ISDEFAULT.get(), "" + attributeConsumer.isIsDefault()); + StaxUtil.writeAttribute(writer, JBossSAMLConstants.INDEX.get(), "" + attributeConsumer.getIndex()); // Service Name @@ -561,4 +563,4 @@ public class SAMLMetadataWriter extends BaseWriter { StaxUtil.writeEndElement(writer); } -} \ No newline at end of file +}