From 8d82390843743e51a888340fb24b34f17f4d3f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20B=C3=A5tstrand?= Date: Fri, 24 Feb 2017 14:02:54 +0100 Subject: [PATCH] KEYCLOAK-4504 New configuration option for SAML Broker: * postBindingLogout: Indicates if POST or redirect should be used for the logout requests. This applies to both IdP-initiated logout, and Keycloak-initiated logout. If unset (for example when upgrading Keycloak), the setting is initially set to the same as postBindingResponse. The flag is also set when importing IdP metadata. --- .../org/keycloak/broker/saml/SAMLEndpoint.java | 2 +- .../broker/saml/SAMLIdentityProvider.java | 7 +++++-- .../broker/saml/SAMLIdentityProviderConfig.java | 14 ++++++++++++++ .../broker/saml/SAMLIdentityProviderFactory.java | 15 +++++++++------ .../testsuite/admin/IdentityProviderTest.java | 1 + .../admin/messages/admin-messages_en.properties | 2 ++ .../partials/realm-identity-provider-saml.html | 7 +++++++ 7 files changed, 39 insertions(+), 9 deletions(-) diff --git a/services/src/main/java/org/keycloak/broker/saml/SAMLEndpoint.java b/services/src/main/java/org/keycloak/broker/saml/SAMLEndpoint.java index 38e57cb256..72d84ee5c0 100755 --- a/services/src/main/java/org/keycloak/broker/saml/SAMLEndpoint.java +++ b/services/src/main/java/org/keycloak/broker/saml/SAMLEndpoint.java @@ -303,7 +303,7 @@ public class SAMLEndpoint { builder.issuer(issuerURL); JaxrsSAML2BindingBuilder binding = new JaxrsSAML2BindingBuilder() .relayState(relayState); - boolean postBinding = config.isPostBindingResponse(); + boolean postBinding = config.isPostBindingLogout(); if (config.isWantAuthnRequestsSigned()) { KeyManager.ActiveRsaKey keys = session.keys().getActiveRsaKey(realm); String keyName = config.getXmlSigKeyInfoKeyNameTransformer().getKeyName(keys.getKid(), keys.getCertificate()); diff --git a/services/src/main/java/org/keycloak/broker/saml/SAMLIdentityProvider.java b/services/src/main/java/org/keycloak/broker/saml/SAMLIdentityProvider.java index 1f8f7933d8..f2ce37d538 100755 --- a/services/src/main/java/org/keycloak/broker/saml/SAMLIdentityProvider.java +++ b/services/src/main/java/org/keycloak/broker/saml/SAMLIdentityProvider.java @@ -184,12 +184,15 @@ public class SAMLIdentityProvider extends AbstractIdentityProvider keyDescriptor = idpDescriptor.getKeyDescriptor(); String defaultCertificate = null; diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/IdentityProviderTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/IdentityProviderTest.java index 2fbb5a30d6..a43591862b 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/IdentityProviderTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/IdentityProviderTest.java @@ -529,6 +529,7 @@ public class IdentityProviderTest extends AbstractAdminTest { assertThat(config.keySet(), containsInAnyOrder( "validateSignature", "singleLogoutServiceUrl", + "postBindingLogout", "postBindingResponse", "postBindingAuthnRequest", "singleSignOnServiceUrl", diff --git a/themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties b/themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties index 76c6d5078e..c1550a7d6a 100644 --- a/themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties +++ b/themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties @@ -523,6 +523,8 @@ http-post-binding-response=HTTP-POST Binding Response http-post-binding-response.tooltip=Indicates whether to respond to requests using HTTP-POST binding. If false, HTTP-REDIRECT binding will be used. http-post-binding-for-authn-request=HTTP-POST Binding for AuthnRequest http-post-binding-for-authn-request.tooltip=Indicates whether the AuthnRequest must be sent using HTTP-POST binding. If false, HTTP-REDIRECT binding will be used. +http-post-binding-logout=HTTP-POST Binding Logout +http-post-binding-logout.tooltip=Indicates whether to respond to requests using HTTP-POST binding. If false, HTTP-REDIRECT binding will be used. want-authn-requests-signed=Want AuthnRequests Signed want-authn-requests-signed.tooltip=Indicates whether the identity provider expects signed a AuthnRequest. force-authentication=Force Authentication diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-saml.html b/themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-saml.html index 3aad92beb0..33623d38cb 100755 --- a/themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-saml.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-saml.html @@ -142,6 +142,13 @@ {{:: 'http-post-binding-for-authn-request.tooltip' | translate}} +
+ +
+ +
+ {{:: 'http-post-binding-logout.tooltip' | translate}} +