Repository: cxf-fediz Updated Branches: refs/heads/master 61be9e5f7 -> def5708ef
Fediz IDP Spring config cleanup Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/def5708e Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/def5708e Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/def5708e Branch: refs/heads/master Commit: def5708efda3b5fef007bf09c4d2f3c8532aea47 Parents: 61be9e5 Author: Jan Bernhardt <jbernha...@talend.com> Authored: Thu Jan 7 17:03:13 2016 +0100 Committer: Jan Bernhardt <jbernha...@talend.com> Committed: Thu Jan 14 17:47:25 2016 +0100 ---------------------------------------------------------------------- .../idp/beans/CacheTokenForWauthAction.java | 3 +- .../service/idp/beans/HomeRealmReminder.java | 4 +- .../fediz/service/idp/beans/LogoutAction.java | 3 +- .../idp/beans/ProcessHRDSExpressionAction.java | 6 +- .../idp/beans/SigninParametersCacheAction.java | 2 + .../idp/beans/TrustedIdpProtocolAction.java | 6 +- .../fediz/service/idp/beans/WfreshParser.java | 3 +- .../WEB-INF/flows/federation-signin-request.xml | 2 +- .../flows/federation-signin-response.xml | 2 +- .../flows/federation-validate-request.xml | 2 +- .../idp/src/main/webapp/WEB-INF/idp-servlet.xml | 129 +++++++------------ .../src/test/resources/realmb/idp-servlet.xml | 19 --- 12 files changed, 63 insertions(+), 118 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/CacheTokenForWauthAction.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/CacheTokenForWauthAction.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/CacheTokenForWauthAction.java index 852a338..15e0589 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/CacheTokenForWauthAction.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/CacheTokenForWauthAction.java @@ -26,13 +26,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; import org.springframework.util.Assert; import org.springframework.webflow.execution.RequestContext; /** * This class is responsible to cache IDP token. */ - +@Component public class CacheTokenForWauthAction { private static final String IDP_CONFIG = "idpConfig"; http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/HomeRealmReminder.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/HomeRealmReminder.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/HomeRealmReminder.java index 51522ca..c755ebf 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/HomeRealmReminder.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/HomeRealmReminder.java @@ -21,10 +21,10 @@ package org.apache.cxf.fediz.service.idp.beans; import javax.servlet.http.Cookie; import org.apache.cxf.fediz.service.idp.util.WebUtils; +import org.springframework.stereotype.Component; import org.springframework.webflow.execution.RequestContext; -/** - */ +@Component public class HomeRealmReminder { public static final String FEDIZ_HOME_REALM = "FEDIZ_HOME_REALM"; http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/LogoutAction.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/LogoutAction.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/LogoutAction.java index 8cc3ecf..b17de18 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/LogoutAction.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/LogoutAction.java @@ -24,12 +24,13 @@ import org.apache.cxf.fediz.service.idp.util.WebUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; import org.springframework.webflow.execution.RequestContext; /** * This class is responsible to clear security context and invalidate IDP session. */ - +@Component public class LogoutAction { private static final Logger LOG = LoggerFactory.getLogger(LogoutAction.class); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/ProcessHRDSExpressionAction.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/ProcessHRDSExpressionAction.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/ProcessHRDSExpressionAction.java index 5389247..e7a9296 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/ProcessHRDSExpressionAction.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/ProcessHRDSExpressionAction.java @@ -22,17 +22,17 @@ import org.apache.cxf.fediz.service.idp.domain.Idp; import org.apache.cxf.fediz.service.idp.util.WebUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; import org.springframework.webflow.execution.RequestContext; /** * This class is responsible to process Home Realm Discovery Service Expression. */ - +@Component public class ProcessHRDSExpressionAction { private static final String IDP_CONFIG = "idpConfig"; - private static final Logger LOG = LoggerFactory - .getLogger(ProcessHRDSExpressionAction.class); + private static final Logger LOG = LoggerFactory.getLogger(ProcessHRDSExpressionAction.class); public String submit(RequestContext context) { Idp idpConfig = (Idp)WebUtils.getAttributeFromFlowScope(context, IDP_CONFIG); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/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 41cac31..a357895 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 @@ -31,8 +31,10 @@ import org.apache.cxf.fediz.service.idp.domain.Idp; import org.apache.cxf.fediz.service.idp.util.WebUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; import org.springframework.webflow.execution.RequestContext; +@Component public class SigninParametersCacheAction { //todo introduce constants class? http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/TrustedIdpProtocolAction.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/TrustedIdpProtocolAction.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/TrustedIdpProtocolAction.java index d1479c5..2369bae 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/TrustedIdpProtocolAction.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/TrustedIdpProtocolAction.java @@ -26,24 +26,22 @@ import org.apache.cxf.fediz.service.idp.protocols.ProtocolController; import org.apache.cxf.fediz.service.idp.spi.TrustedIdpProtocolHandler; import org.apache.cxf.fediz.service.idp.util.WebUtils; import org.apache.cxf.ws.security.tokenstore.SecurityToken; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; import org.springframework.webflow.execution.RequestContext; /** * This class is responsible to clear security context and invalidate IDP session. */ - +@Component public class TrustedIdpProtocolAction { private static final Logger LOG = LoggerFactory.getLogger(TrustedIdpProtocolAction.class); private static final String IDP_CONFIG = "idpConfig"; - @Autowired // Qualifier workaround. See http://www.jayway.com/2013/11/03/spring-and-autowiring-of-generic-types/ http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java index 3fba1c8..d7f03d6 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java @@ -24,12 +24,13 @@ import org.apache.cxf.fediz.service.idp.util.WebUtils; import org.apache.cxf.ws.security.tokenstore.SecurityToken; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; import org.springframework.webflow.execution.RequestContext; /** * This class is responsible to parse 'wfresh' parameter */ - +@Component public class WfreshParser { private static final Logger LOG = LoggerFactory http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-request.xml ---------------------------------------------------------------------- diff --git a/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-request.xml b/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-request.xml index 1231444..fc44654 100644 --- a/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-request.xml +++ b/services/idp/src/main/webapp/WEB-INF/flows/federation-signin-request.xml @@ -182,7 +182,7 @@ <!-- redirects to requestor idp --> <end-state id="redirectToTrustedIDP"> <on-entry> - <evaluate expression="signInParamCacheAction.store(flowRequestContext)" /> + <evaluate expression="signinParametersCacheAction.store(flowRequestContext)" /> </on-entry> <output name="whr" value="flowScope.whr" /> <output name="wctx" value="flowScope.wctx" /> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/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 e060b46..9e6d342 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 @@ -32,7 +32,7 @@ <on-start> <!-- restore 'wreply','wtrealm','whr' for current 'wctx' --> - <evaluate expression="signInParamCacheAction.restore(flowRequestContext)" /> + <evaluate expression="signinParametersCacheAction.restore(flowRequestContext)" /> </on-start> <!-- validate token issued by requestor IDP ('wresult') given its 'whr' --> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/webapp/WEB-INF/flows/federation-validate-request.xml ---------------------------------------------------------------------- diff --git a/services/idp/src/main/webapp/WEB-INF/flows/federation-validate-request.xml b/services/idp/src/main/webapp/WEB-INF/flows/federation-validate-request.xml index d8ebd2d..cff2962 100644 --- a/services/idp/src/main/webapp/WEB-INF/flows/federation-validate-request.xml +++ b/services/idp/src/main/webapp/WEB-INF/flows/federation-validate-request.xml @@ -134,7 +134,7 @@ <evaluate expression="stsClientForRpAction.submit(flowRequestContext)" result="flowScope.rpToken"/> </on-entry> - <evaluate expression="signInParamCacheAction.storeRPConfigInSession(flowRequestContext)" + <evaluate expression="signinParametersCacheAction.storeRPConfigInSession(flowRequestContext)" result="flowScope.res"/> <transition to="isWReplyProvided" /> <transition on-exception="org.apache.cxf.fediz.core.exception.ProcessingException" to="viewBadRequest" /> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/services/idp/src/main/webapp/WEB-INF/idp-servlet.xml ---------------------------------------------------------------------- diff --git a/services/idp/src/main/webapp/WEB-INF/idp-servlet.xml b/services/idp/src/main/webapp/WEB-INF/idp-servlet.xml index 1d80557..003969a 100644 --- a/services/idp/src/main/webapp/WEB-INF/idp-servlet.xml +++ b/services/idp/src/main/webapp/WEB-INF/idp-servlet.xml @@ -33,114 +33,75 @@ http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd"> <context:property-placeholder location="classpath:realm.properties" /> - + <context:component-scan base-package="org.apache.cxf.fediz.service.idp.beans" /> <mvc:resources mapping="/images/**" location="/resources/images/" /> - <mvc:view-controller path="/" view-name="index" /> - <mvc:view-controller path="/federation/up/login" view-name="signinform" /> + <mvc:view-controller path="/" view-name="index" /> + <mvc:view-controller path="/federation/up/login" view-name="signinform" /> + + <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> + <property name="prefix" value="/WEB-INF/views/" /> + <property name="suffix" value=".jsp" /> + </bean> - <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping" - p:flowRegistry-ref="flowRegistry" p:order="2"> + <bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> + <property name="viewResolvers"> + <list> + <ref local="viewResolver" /> + </list> + </property> </bean> - <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter" - p:flowExecutor-ref="flowExecutor" /> + <bean id="expressionParser" class="org.springframework.webflow.expression.WebFlowOgnlExpressionParser" /> - <webflow:flow-executor id="flowExecutor" - flow-registry="flowRegistry"> + <webflow:flow-builder-services id="builder" view-factory-creator="viewFactoryCreator" + expression-parser="expressionParser" /> + + <webflow:flow-registry id="flowRegistry" flow-builder-services="builder"> + <webflow:flow-location path="/WEB-INF/flows/federation-validate-request.xml" id="federation" /> + <webflow:flow-location path="/WEB-INF/flows/federation-validate-request.xml" id="federation/up" /> + <webflow:flow-location path="/WEB-INF/flows/federation-validate-request.xml" id="federation/krb" /> + <webflow:flow-location path="/WEB-INF/flows/federation-validate-request.xml" id="federation/clientcert" /> + <webflow:flow-location path="/WEB-INF/flows/federation-signin-request.xml" id="signinRequest" /> + <webflow:flow-location path="/WEB-INF/flows/federation-signin-response.xml" id="signinResponse" /> + </webflow:flow-registry> + + <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping" p:flowRegistry-ref="flowRegistry" + p:order="2"> + </bean> + + <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry"> <webflow:flow-execution-attributes> - <webflow:always-redirect-on-pause - value="false" /> + <webflow:always-redirect-on-pause value="false" /> </webflow:flow-execution-attributes> - <webflow:flow-execution-listeners> - <webflow:listener ref="securityFlowExecutionListener" /> - </webflow:flow-execution-listeners> + <webflow:flow-execution-listeners> + <webflow:listener ref="securityFlowExecutionListener" /> + </webflow:flow-execution-listeners> </webflow:flow-executor> - <bean id="securityFlowExecutionListener" - class="org.springframework.webflow.security.SecurityFlowExecutionListener"> + <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter" p:flowExecutor-ref="flowExecutor" /> + + <bean id="securityFlowExecutionListener" class="org.springframework.webflow.security.SecurityFlowExecutionListener"> <property name="accessDecisionManager" ref="accessDecisionManager" /> </bean> - <bean id="accessDecisionManager" - class="org.springframework.security.access.vote.AffirmativeBased"> + <bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased"> <property name="decisionVoters"> <list> - <bean - class="org.springframework.security.access.vote.RoleVoter"> + <bean class="org.springframework.security.access.vote.RoleVoter"> <property name="rolePrefix" value="ROLE_" /> </bean> - <bean - class="org.springframework.security.access.vote.AuthenticatedVoter" /> + <bean class="org.springframework.security.access.vote.AuthenticatedVoter" /> </list> </property> </bean> - <webflow:flow-registry id="flowRegistry" - flow-builder-services="builder"> - <webflow:flow-location - path="/WEB-INF/flows/federation-validate-request.xml" id="federation" /> - <webflow:flow-location - path="/WEB-INF/flows/federation-validate-request.xml" id="federation/up" /> - <webflow:flow-location - path="/WEB-INF/flows/federation-validate-request.xml" id="federation/krb" /> - <webflow:flow-location - path="/WEB-INF/flows/federation-validate-request.xml" id="federation/clientcert" /> - <webflow:flow-location path="/WEB-INF/flows/federation-signin-request.xml" - id="signinRequest" /> - <webflow:flow-location path="/WEB-INF/flows/federation-signin-response.xml" - id="signinResponse" /> - </webflow:flow-registry> - - <webflow:flow-builder-services id="builder" - view-factory-creator="viewFactoryCreator" expression-parser="expressionParser" /> - - <bean id="expressionParser" - class="org.springframework.webflow.expression.WebFlowOgnlExpressionParser" /> - - <bean id="viewFactoryCreator" - class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> - <property name="viewResolvers"> - <list> - <ref local="viewResolver" /> - </list> - </property> - </bean> - - <bean id="viewResolver" - class="org.springframework.web.servlet.view.InternalResourceViewResolver"> - <property name="prefix" value="/WEB-INF/views/" /> - <property name="suffix" value=".jsp" /> - </bean> - - <bean id="stsClientForRpAction" - class="org.apache.cxf.fediz.service.idp.beans.STSClientAction"> - <property name="wsdlLocation" - value="https://localhost:0/fediz-idp-sts/${realm.STS_URI}/STSServiceTransport?wsdl" /> + <bean id="stsClientForRpAction" class="org.apache.cxf.fediz.service.idp.beans.STSClientAction"> + <property name="wsdlLocation" value="https://localhost:0/fediz-idp-sts/${realm.STS_URI}/STSServiceTransport?wsdl" /> <property name="wsdlEndpoint" value="Transport_Port" /> - <property name="tokenType" - value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0" /> + <property name="tokenType" value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0" /> </bean> - <bean id="signInParamCacheAction" - class="org.apache.cxf.fediz.service.idp.beans.SigninParametersCacheAction" /> - - <bean id="logoutAction" class="org.apache.cxf.fediz.service.idp.beans.LogoutAction" /> - - <bean id="wfreshParser" class="org.apache.cxf.fediz.service.idp.beans.WfreshParser" /> - - <bean id="cacheTokenForWauthAction" - class="org.apache.cxf.fediz.service.idp.beans.CacheTokenForWauthAction" /> - - <bean id="processHRDSExpressionAction" - class="org.apache.cxf.fediz.service.idp.beans.ProcessHRDSExpressionAction" /> - - <bean id="homeRealmReminder" - class="org.apache.cxf.fediz.service.idp.beans.HomeRealmReminder" /> - - <bean id="trustedIdpProtocolAction" - class="org.apache.cxf.fediz.service.idp.beans.TrustedIdpProtocolAction" /> - </beans> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/def5708e/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml ---------------------------------------------------------------------- diff --git a/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml b/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml index cd6103c..0a68517 100644 --- a/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml +++ b/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml @@ -113,23 +113,4 @@ value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0" /> </bean> - <bean id="signInParamCacheAction" - class="org.apache.cxf.fediz.service.idp.beans.SigninParametersCacheAction" /> - - <bean id="logoutAction" class="org.apache.cxf.fediz.service.idp.beans.LogoutAction" /> - - <bean id="wfreshParser" class="org.apache.cxf.fediz.service.idp.beans.WfreshParser" /> - - <bean id="cacheTokenForWauthAction" - class="org.apache.cxf.fediz.service.idp.beans.CacheTokenForWauthAction" /> - - <bean id="processHRDSExpressionAction" - class="org.apache.cxf.fediz.service.idp.beans.ProcessHRDSExpressionAction" /> - - <bean id="homeRealmReminder" - class="org.apache.cxf.fediz.service.idp.beans.HomeRealmReminder" /> - - <bean id="trustedIdpProtocolAction" - class="org.apache.cxf.fediz.service.idp.beans.TrustedIdpProtocolAction" /> - </beans>