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".
This commit is contained in:
Luca Leonardo Scorcia 2020-09-06 18:09:13 +02:00 committed by Hynek Mlnařík
parent 10077b1efe
commit 3973d47bd4

View file

@ -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