Significantly enhance channel processing filter.
This commit is contained in:
@@ -159,6 +159,34 @@
|
||||
|
||||
<bean id="backendContactManagerTarget" class="sample.contact.ContactManagerBackend"/>
|
||||
|
||||
<!-- ===================== HTTP CHANNEL REQUIREMENTS ==================== -->
|
||||
|
||||
<bean id="channelProcessingFilter" class="net.sf.acegisecurity.securechannel.ChannelProcessingFilter">
|
||||
<property name="channelDecisionManager"><ref bean="channelDecisionManager"/></property>
|
||||
<property name="secureChannelEntryPoint"><ref bean="secureChannelEntryPoint"/></property>
|
||||
<property name="insecureChannelEntryPoint"><ref bean="insecureChannelEntryPoint"/></property>
|
||||
<property name="filterInvocationDefinitionSource">
|
||||
<value>
|
||||
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
|
||||
\A/secure/.*\Z=REQUIRES_SECURE_CHANNEL
|
||||
\A/j_acegi_cas_security_check.*\Z=REQUIRES_SECURE_CHANNEL
|
||||
\A.*\Z=REQUIRES_INSECURE_CHANNEL
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="channelDecisionManager" class="net.sf.acegisecurity.securechannel.ChannelDecisionManagerImpl"/>
|
||||
|
||||
<bean id="secureChannelEntryPoint" class="net.sf.acegisecurity.securechannel.RetryWithHttpsEntryPoint">
|
||||
<property name="portMapper"><ref bean="portMapper"/></property>
|
||||
<property name="portResolver"><ref bean="portResolver"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="insecureChannelEntryPoint" class="net.sf.acegisecurity.securechannel.RetryWithHttpEntryPoint">
|
||||
<property name="portMapper"><ref bean="portMapper"/></property>
|
||||
<property name="portResolver"><ref bean="portResolver"/></property>
|
||||
</bean>
|
||||
|
||||
<!-- ===================== HTTP REQUEST SECURITY ==================== -->
|
||||
|
||||
<bean id="casProcessingFilter" class="net.sf.acegisecurity.ui.cas.CasProcessingFilter">
|
||||
@@ -171,6 +199,7 @@
|
||||
<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter">
|
||||
<property name="filterSecurityInterceptor"><ref bean="filterInvocationInterceptor"/></property>
|
||||
<property name="authenticationEntryPoint"><ref bean="casProcessingFilterEntryPoint"/></property>
|
||||
<property name="portResolver"><ref bean="portResolver"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="casProcessingFilterEntryPoint" class="net.sf.acegisecurity.ui.cas.CasProcessingFilterEntryPoint">
|
||||
@@ -178,6 +207,14 @@
|
||||
<property name="serviceProperties"><ref bean="serviceProperties"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="portMapper" class="net.sf.acegisecurity.util.PortMapperImpl"/>
|
||||
|
||||
<!-- Comment the always[Scheme]Port properties to use ServletRequest.getServerPort() -->
|
||||
<bean id="portResolver" class="net.sf.acegisecurity.util.PortResolverImpl">
|
||||
<property name="alwaysHttpPort"><value>8080</value></property>
|
||||
<property name="alwaysHttpsPort"><value>8443</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="httpRequestAccessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
|
||||
<property name="allowIfAllAbstainDecisions"><value>false</value></property>
|
||||
<property name="decisionVoters">
|
||||
|
||||
@@ -33,6 +33,15 @@
|
||||
<param-value>/WEB-INF/applicationContext.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
<filter-name>Acegi Channel Processing Filter</filter-name>
|
||||
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
|
||||
<init-param>
|
||||
<param-name>targetClass</param-name>
|
||||
<param-value>net.sf.acegisecurity.securechannel.ChannelProcessingFilter</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>Acegi CAS Processing Filter</filter-name>
|
||||
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
|
||||
@@ -65,6 +74,11 @@
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Acegi Channel Processing Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Acegi CAS Processing Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
|
||||
@@ -134,23 +134,36 @@
|
||||
<bean id="backendContactManagerTarget" class="sample.contact.ContactManagerBackend"/>
|
||||
|
||||
<!-- ===================== HTTP CHANNEL REQUIREMENTS ==================== -->
|
||||
|
||||
<!-- You will need to uncomment the "Acegi Channel Processing Filter"
|
||||
<filter-mapping> in web.xml for the following beans to be used -->
|
||||
|
||||
<bean id="channelProcessingFilter" class="net.sf.acegisecurity.securechannel.ChannelProcessingFilter">
|
||||
<property name="channelDecisionManager"><ref bean="channelDecisionManager"/></property>
|
||||
<property name="channelEntryPoint"><ref bean="channelEntryPoint"/></property>
|
||||
<property name="secureChannelEntryPoint"><ref bean="secureChannelEntryPoint"/></property>
|
||||
<property name="insecureChannelEntryPoint"><ref bean="insecureChannelEntryPoint"/></property>
|
||||
<property name="filterInvocationDefinitionSource">
|
||||
<value>
|
||||
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
|
||||
\A/secure/.*\Z=REQUIRES_SECURE_CHANNEL
|
||||
\A/info/.*\Z=REQUIRES_SECURE_CHANNEL
|
||||
\A/acegilogin.jsp.*\Z=REQUIRES_SECURE_CHANNEL
|
||||
\A/j_acegi_security_check.*\Z=REQUIRES_SECURE_CHANNEL
|
||||
\A.*\Z=REQUIRES_INSECURE_CHANNEL
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="channelDecisionManager" class="net.sf.acegisecurity.securechannel.ChannelDecisionManagerImpl"/>
|
||||
|
||||
<bean id="channelEntryPoint" class="net.sf.acegisecurity.securechannel.RetryWithHttpsEntryPoint"/>
|
||||
<bean id="secureChannelEntryPoint" class="net.sf.acegisecurity.securechannel.RetryWithHttpsEntryPoint">
|
||||
<property name="portMapper"><ref bean="portMapper"/></property>
|
||||
<property name="portResolver"><ref bean="portResolver"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="insecureChannelEntryPoint" class="net.sf.acegisecurity.securechannel.RetryWithHttpEntryPoint">
|
||||
<property name="portMapper"><ref bean="portMapper"/></property>
|
||||
<property name="portResolver"><ref bean="portResolver"/></property>
|
||||
</bean>
|
||||
|
||||
<!-- ===================== HTTP REQUEST SECURITY ==================== -->
|
||||
|
||||
@@ -164,10 +177,22 @@
|
||||
<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter">
|
||||
<property name="filterSecurityInterceptor"><ref bean="filterInvocationInterceptor"/></property>
|
||||
<property name="authenticationEntryPoint"><ref bean="authenticationProcessingFilterEntryPoint"/></property>
|
||||
<property name="portResolver"><ref bean="portResolver"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="authenticationProcessingFilterEntryPoint" class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
|
||||
<property name="loginFormUrl"><value>/acegilogin.jsp</value></property>
|
||||
<property name="forceHttps"><value>false</value></property>
|
||||
<property name="portMapper"><ref bean="portMapper"/></property>
|
||||
<property name="portResolver"><ref bean="portResolver"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="portMapper" class="net.sf.acegisecurity.util.PortMapperImpl"/>
|
||||
|
||||
<!-- Comment the always[Scheme]Port properties to use ServletRequest.getServerPort() -->
|
||||
<bean id="portResolver" class="net.sf.acegisecurity.util.PortResolverImpl">
|
||||
<property name="alwaysHttpPort"><value>8080</value></property>
|
||||
<property name="alwaysHttpsPort"><value>8443</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="httpRequestAccessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/applicationContext.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>Acegi Channel Processing Filter</filter-name>
|
||||
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
|
||||
<init-param>
|
||||
@@ -64,12 +64,16 @@
|
||||
<param-value>net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
|
||||
<!-- Remove the comments from the following <filter-mapping> if you'd
|
||||
like to ensure secure URLs are only available over HTTPS -->
|
||||
<!--
|
||||
<filter-mapping>
|
||||
<filter-name>Acegi Channel Processing Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
-->
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Acegi Authentication Processing Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
@@ -99,7 +103,7 @@
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
<!--
|
||||
- Servlet that dispatches request to registered handlers (Controller implementations).
|
||||
- Has its own application context, by default defined in "{servlet-name}-servlet.xml",
|
||||
|
||||
Reference in New Issue
Block a user