Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0290917642 for ; Wed, 18 Mar 2015 17:19:26 +0000 (UTC) Received: (qmail 212 invoked by uid 500); 18 Mar 2015 17:19:25 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 133 invoked by uid 500); 18 Mar 2015 17:19:25 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 99908 invoked by uid 99); 18 Mar 2015 17:19:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Mar 2015 17:19:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9A843E1876; Wed, 18 Mar 2015 17:19:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@cxf.apache.org Date: Wed, 18 Mar 2015 17:19:25 -0000 Message-Id: <3b0a2fc10e9849e7afbce255e7363cf2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] cxf-fediz git commit: Store the SAML SSO RequestId on the context Repository: cxf-fediz Updated Branches: refs/heads/master 8b0146d7d -> 9fa14d005 Store the SAML SSO RequestId on the context Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/bd7dc9f1 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/bd7dc9f1 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/bd7dc9f1 Branch: refs/heads/master Commit: bd7dc9f12a7f89ca87a894f50dfc46b1baea08a6 Parents: 8b0146d Author: Colm O hEigeartaigh Authored: Wed Mar 18 16:11:58 2015 +0000 Committer: Colm O hEigeartaigh Committed: Wed Mar 18 16:11:58 2015 +0000 ---------------------------------------------------------------------- .../idp/protocols/TrustedIdpSAMLProtocolHandler.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bd7dc9f1/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java index 2cc03c3..4163b20 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/protocols/TrustedIdpSAMLProtocolHandler.java @@ -39,7 +39,6 @@ import javax.ws.rs.core.UriBuilder; import org.w3c.dom.Document; import org.w3c.dom.Element; - import org.apache.cxf.common.util.Base64Exception; import org.apache.cxf.common.util.Base64Utility; import org.apache.cxf.common.util.StringUtils; @@ -82,6 +81,7 @@ public class TrustedIdpSAMLProtocolHandler implements TrustedIdpProtocolHandler public static final String PROTOCOL = "urn:oasis:names:tc:SAML:2.0:profiles:SSO:browser"; private static final Logger LOG = LoggerFactory.getLogger(TrustedIdpSAMLProtocolHandler.class); + private static final String SAML_SSO_REQUEST_ID = "saml-sso-request-id"; private AuthnRequestBuilder authnRequestBuilder = new DefaultAuthnRequestBuilder(); // private long stateTimeToLive = SSOConstants.DEFAULT_STATE_TIME; @@ -131,6 +131,10 @@ public class TrustedIdpSAMLProtocolHandler implements TrustedIdpProtocolHandler if (trustedIdp.isSignRequest()) { signRequest(urlEncodedRequest, wctx, idp, ub); } + + // Store the Request ID + String authnRequestId = authnRequest.getID(); + WebUtils.putAttributeInExternalContext(context, SAML_SSO_REQUEST_ID, authnRequestId); // TODO How to set headers here? // .header(HttpHeaders.CACHE_CONTROL, "no-cache, no-store") @@ -367,7 +371,11 @@ public class TrustedIdpSAMLProtocolHandler implements TrustedIdpProtocolHandler ssoResponseValidator.setClientAddress(servletRequest.getRemoteAddr()); ssoResponseValidator.setIssuerIDP(trustedIdp.getUrl()); - // TODO ssoResponseValidator.setRequestId(requestState.getSamlRequestId()); + + // Get the stored request ID + String requestId = + (String)WebUtils.getAttributeFromExternalContext(requestContext, SAML_SSO_REQUEST_ID); + ssoResponseValidator.setRequestId(requestId); ssoResponseValidator.setSpIdentifier(idp.getRealm()); ssoResponseValidator.setEnforceAssertionsSigned(true); ssoResponseValidator.setEnforceKnownIssuer(true);