Got SAML -> WSFed -> SAML working
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/04fa2ea1 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/04fa2ea1 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/04fa2ea1 Branch: refs/heads/master Commit: 04fa2ea1b3602051245c6b42d366e9f4a34913ae Parents: d283080 Author: Colm O hEigeartaigh <[email protected]> Authored: Thu Nov 3 12:43:17 2016 +0000 Committer: Colm O hEigeartaigh <[email protected]> Committed: Thu Nov 3 12:43:17 2016 +0000 ---------------------------------------------------------------------- .../idp/beans/SigninParametersCacheAction.java | 14 +++++++------- .../WEB-INF/flows/federation-signin-response.xml | 1 + .../webapp/WEB-INF/flows/saml-validate-request.xml | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/04fa2ea1/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java index b696b6d..4b2b308 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/SigninParametersCacheAction.java @@ -29,6 +29,7 @@ import org.apache.cxf.fediz.core.exception.ProcessingException; import org.apache.cxf.fediz.service.idp.IdpConstants; import org.apache.cxf.fediz.service.idp.domain.Application; import org.apache.cxf.fediz.service.idp.domain.Idp; +import org.apache.cxf.fediz.service.idp.samlsso.SAMLAuthnRequest; import org.apache.cxf.fediz.service.idp.util.WebUtils; import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants; import org.slf4j.Logger; @@ -49,8 +50,6 @@ public class SigninParametersCacheAction { Map<String, Object> signinParams = new HashMap<>(); String uuidKey = UUID.randomUUID().toString(); - WebUtils.removeAttributeFromFlowScope(context, IdpConstants.SAML_AUTHN_REQUEST); - Object value = WebUtils.getAttributeFromFlowScope(context, FederationConstants.PARAM_REPLY); if (value != null) { signinParams.put(FederationConstants.PARAM_REPLY, value); @@ -71,9 +70,9 @@ public class SigninParametersCacheAction { if (value != null) { signinParams.put(FederationConstants.PARAM_CONTEXT, value); } - value = WebUtils.getAttributeFromFlowScope(context, "SAMLRequest"); + value = WebUtils.getAttributeFromFlowScope(context, IdpConstants.SAML_AUTHN_REQUEST); if (value != null) { - signinParams.put("SAMLRequest", value); + signinParams.put(IdpConstants.SAML_AUTHN_REQUEST, value); } WebUtils.putAttributeInExternalContext(context, uuidKey, signinParams); @@ -118,9 +117,10 @@ public class SigninParametersCacheAction { WebUtils.putAttributeInFlowScope(context, IdpConstants.HOME_REALM, value); } - value = (String)signinParams.get("SAMLRequest"); - if (value != null) { - WebUtils.putAttributeInFlowScope(context, "SAMLRequest", value); + SAMLAuthnRequest authnRequest = + (SAMLAuthnRequest)signinParams.get(IdpConstants.SAML_AUTHN_REQUEST); + if (authnRequest != null) { + WebUtils.putAttributeInFlowScope(context, IdpConstants.SAML_AUTHN_REQUEST, authnRequest); } LOG.debug("SignIn parameters restored: {}", signinParams.toString()); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/04fa2ea1/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-response.xml ---------------------------------------------------------------------- diff --git a/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-response.xml b/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-response.xml index 5697173..a71e6cd 100644 --- a/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-response.xml +++ b/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-response.xml @@ -64,6 +64,7 @@ <output name="wreply" value="flowScope.wreply" /> <output name="wtrealm" value="flowScope.wtrealm" /> <output name="idpToken" value="flowScope.idpToken" /> + <output name="saml_authn_request" value="flowScope.saml_authn_request" /> </end-state> <!-- abnormal exit point : Http 400 Bad Request --> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/04fa2ea1/services/idp/src/main/webapp/WEB-INF/flows/saml-validate-request.xml ---------------------------------------------------------------------- diff --git a/services/idp/src/main/webapp/WEB-INF/flows/saml-validate-request.xml b/services/idp/src/main/webapp/WEB-INF/flows/saml-validate-request.xml index c49324c..f03c985 100644 --- a/services/idp/src/main/webapp/WEB-INF/flows/saml-validate-request.xml +++ b/services/idp/src/main/webapp/WEB-INF/flows/saml-validate-request.xml @@ -87,6 +87,7 @@ <output name="wctx" /> <output name="whr" /> <output name="idpToken" /> + <output name="saml_authn_request" /> <transition on="requestRpToken" to="requestRpToken"> <set name="flowScope.home_realm" value="currentEvent.attributes.whr" />
