diff --git a/saml-core/src/main/java/org/keycloak/saml/SAML2LogoutRequestBuilder.java b/saml-core/src/main/java/org/keycloak/saml/SAML2LogoutRequestBuilder.java index d0e81ba49b..b1cd113e09 100755 --- a/saml-core/src/main/java/org/keycloak/saml/SAML2LogoutRequestBuilder.java +++ b/saml-core/src/main/java/org/keycloak/saml/SAML2LogoutRequestBuilder.java @@ -85,18 +85,20 @@ public class SAML2LogoutRequestBuilder implements SamlProtocolExtensionsAwareBui } public Document buildDocument() throws ProcessingException, ConfigurationException, ParsingException { - Document document = new SAML2Request().convert(createLogoutRequest()); + Document document = SAML2Request.convert(createLogoutRequest()); return document; } private LogoutRequestType createLogoutRequest() throws ConfigurationException { - LogoutRequestType lort = new SAML2Request().createLogoutRequest(issuer); + LogoutRequestType lort = SAML2Request.createLogoutRequest(issuer); NameIDType nameID = new NameIDType(); nameID.setValue(userPrincipal); //Deal with NameID Format String nameIDFormat = userPrincipalFormat; - nameID.setFormat(URI.create(nameIDFormat)); + if (nameIDFormat != null) { + nameID.setFormat(URI.create(nameIDFormat)); + } lort.setNameID(nameID); if (issuer != null) { diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/saml/CreateLogoutRequestStepBuilder.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/saml/CreateLogoutRequestStepBuilder.java index ee594d0a22..ceeb5fbbb4 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/saml/CreateLogoutRequestStepBuilder.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/saml/CreateLogoutRequestStepBuilder.java @@ -99,8 +99,10 @@ public class CreateLogoutRequestStepBuilder extends SamlDocumentStepBuilder