Repository: cxf-fediz Updated Branches: refs/heads/master 5b6839011 -> 55084c85a
Refactor IdP servlet config to make it more extensible Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/55084c85 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/55084c85 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/55084c85 Branch: refs/heads/master Commit: 55084c85af6b3f025833f76c089286af5a9a20cb Parents: 5b68390 Author: Colm O hEigeartaigh <cohei...@apache.org> Authored: Mon Oct 17 15:35:05 2016 +0100 Committer: Colm O hEigeartaigh <cohei...@apache.org> Committed: Mon Oct 17 15:35:05 2016 +0100 ---------------------------------------------------------------------- .../main/webapp/WEB-INF/applicationContext.xml | 8 +- .../webapp/WEB-INF/config/idp-core-servlet.xml | 108 +++++++++++++++++++ .../idp/src/main/webapp/WEB-INF/idp-servlet.xml | 84 +-------------- 3 files changed, 113 insertions(+), 87 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/55084c85/services/idp/src/main/webapp/WEB-INF/applicationContext.xml ---------------------------------------------------------------------- diff --git a/services/idp/src/main/webapp/WEB-INF/applicationContext.xml b/services/idp/src/main/webapp/WEB-INF/applicationContext.xml index 8af7497..ee2b3d6 100644 --- a/services/idp/src/main/webapp/WEB-INF/applicationContext.xml +++ b/services/idp/src/main/webapp/WEB-INF/applicationContext.xml @@ -20,19 +20,13 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:cxf="http://cxf.apache.org/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:http="http://cxf.apache.org/transports/http/configuration" - xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd - http://cxf.apache.org/transports/http/configuration - http://cxf.apache.org/schemas/configuration/http-conf.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.1.xsd - http://cxf.apache.org/configuration/security - http://cxf.apache.org/schemas/configuration/security.xsd"> + http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <context:component-scan base-package="org.apache.cxf.fediz.service.idp.protocols" /> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/55084c85/services/idp/src/main/webapp/WEB-INF/config/idp-core-servlet.xml ---------------------------------------------------------------------- diff --git a/services/idp/src/main/webapp/WEB-INF/config/idp-core-servlet.xml b/services/idp/src/main/webapp/WEB-INF/config/idp-core-servlet.xml new file mode 100644 index 0000000..e092828 --- /dev/null +++ b/services/idp/src/main/webapp/WEB-INF/config/idp-core-servlet.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:webflow="http://www.springframework.org/schema/webflow-config" + xmlns:p="http://www.springframework.org/schema/p" + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.1.xsd + http://www.springframework.org/schema/mvc + http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd + http://www.springframework.org/schema/webflow-config + http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd"> + + <context:component-scan base-package="org.apache.cxf.fediz.service.idp.beans" /> + + <mvc:resources mapping="/images/**" location="/resources/images/" /> + + <mvc:resources mapping="/swagger/**" location="/resources/swagger/" /> + + <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 id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> + <property name="viewResolvers"> + <list> + <ref local="viewResolver" /> + </list> + </property> + </bean> + + <bean id="expressionParser" class="org.springframework.webflow.expression.WebFlowOgnlExpressionParser" /> + + <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-location path="/WEB-INF/flows/saml-validate-request.xml" id="saml" /> + <webflow:flow-location path="/WEB-INF/flows/saml-validate-request.xml" id="saml/up" /> + <webflow:flow-location path="/WEB-INF/flows/saml-validate-request.xml" id="saml/krb" /> + <webflow:flow-location path="/WEB-INF/flows/saml-validate-request.xml" id="saml/clientcert" /> + <webflow:flow-location path="/WEB-INF/flows/saml-signin-request.xml" id="signinSAMLRequest" /> + </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:flow-execution-attributes> + + <webflow:flow-execution-listeners> + <webflow:listener ref="securityFlowExecutionListener" /> + </webflow:flow-execution-listeners> + </webflow:flow-executor> + + <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"> + <property name="decisionVoters"> + <list> + <bean class="org.springframework.security.access.vote.RoleVoter"> + <property name="rolePrefix" value="ROLE_" /> + </bean> + <bean class="org.springframework.security.access.vote.AuthenticatedVoter" /> + </list> + </property> + </bean> + +</beans> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/55084c85/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 2cb89bd..d145cba 100644 --- a/services/idp/src/main/webapp/WEB-INF/idp-servlet.xml +++ b/services/idp/src/main/webapp/WEB-INF/idp-servlet.xml @@ -20,92 +20,16 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webflow="http://www.springframework.org/schema/webflow-config" - xmlns:p="http://www.springframework.org/schema/p" - xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.1.xsd - http://www.springframework.org/schema/mvc - http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd - http://www.springframework.org/schema/webflow-config - http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd"> + http://www.springframework.org/schema/context/spring-context-3.1.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:resources mapping="/swagger/**" location="/resources/swagger/" /> - - <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 id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> - <property name="viewResolvers"> - <list> - <ref local="viewResolver" /> - </list> - </property> - </bean> - - <bean id="expressionParser" class="org.springframework.webflow.expression.WebFlowOgnlExpressionParser" /> - - <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-location path="/WEB-INF/flows/saml-validate-request.xml" id="saml" /> - <webflow:flow-location path="/WEB-INF/flows/saml-validate-request.xml" id="saml/up" /> - <webflow:flow-location path="/WEB-INF/flows/saml-validate-request.xml" id="saml/krb" /> - <webflow:flow-location path="/WEB-INF/flows/saml-validate-request.xml" id="saml/clientcert" /> - <webflow:flow-location path="/WEB-INF/flows/saml-signin-request.xml" id="signinSAMLRequest" /> - </webflow:flow-registry> + <import resource="config/idp-core-servlet.xml" /> - <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:flow-execution-attributes> - - <webflow:flow-execution-listeners> - <webflow:listener ref="securityFlowExecutionListener" /> - </webflow:flow-execution-listeners> - </webflow:flow-executor> - - <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"> - <property name="decisionVoters"> - <list> - <bean class="org.springframework.security.access.vote.RoleVoter"> - <property name="rolePrefix" value="ROLE_" /> - </bean> - <bean class="org.springframework.security.access.vote.AuthenticatedVoter" /> - </list> - </property> - </bean> + <!-- Define some mutable properties for the IdP --> + <context:property-placeholder location="classpath:realm.properties" /> <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" />