| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
- <!--
- - Application context containing authentication, channel
- - security and web URI beans.
- -
- - Only used by "cas" artifact.
- -
- - $Id: applicationContext-acegi-security.xml 1409 2006-04-26 23:36:03Z benalex $
- -->
- <beans>
- <!-- ======================== FILTER CHAIN ======================= -->
- <bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy">
- <property name="filterInvocationDefinitionSource">
- <value>
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- PATTERN_TYPE_APACHE_ANT
- /**=channelProcessingFilter,httpSessionContextIntegrationFilter,logoutFilter,casProcessingFilter,basicProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor
- </value>
- </property>
- </bean>
- <!-- ======================== AUTHENTICATION ======================= -->
- <bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager">
- <property name="providers">
- <list>
- <ref local="casAuthenticationProvider"/>
- </list>
- </property>
- </bean>
- <bean id="jdbcDaoImpl" class="org.springframework.security.userdetails.jdbc.JdbcDaoImpl">
- <property name="dataSource" ref="dataSource"/>
- </bean>
- <bean id="basicProcessingFilter" class="org.springframework.security.ui.basicauth.BasicProcessingFilter">
- <property name="authenticationManager"><ref local="authenticationManager"/></property>
- <property name="authenticationEntryPoint"><ref local="basicProcessingFilterEntryPoint"/></property>
- </bean>
- <bean id="basicProcessingFilterEntryPoint" class="org.springframework.security.ui.basicauth.BasicProcessingFilterEntryPoint">
- <property name="realmName"><value>Contacts Realm</value></property>
- </bean>
- <bean id="httpSessionContextIntegrationFilter" class="org.springframework.security.context.HttpSessionContextIntegrationFilter"/>
- <bean id="casAuthenticationProvider" class="org.springframework.security.providers.cas.CasAuthenticationProvider">
- <property name="casAuthoritiesPopulator"><ref local="casAuthoritiesPopulator"/></property>
- <property name="casProxyDecider"><ref local="casProxyDecider"/></property>
- <property name="ticketValidator"><ref local="casProxyTicketValidator"/></property>
- <property name="statelessTicketCache"><ref local="statelessTicketCache"/></property>
- <property name="key"><value>my_password_for_this_auth_provider_only</value></property>
- </bean>
- <bean id="casProxyTicketValidator" class="org.springframework.security.providers.cas.ticketvalidator.CasProxyTicketValidator">
- <property name="casValidate" value="https://localhost:8443/cas/proxyValidate"/>
- <property name="proxyCallbackUrl" value="https://localhost:8443/contacts-cas/casProxy/receptor"/>
- <property name="serviceProperties"><ref local="serviceProperties"/></property>
- <!-- <property name="trustStore"><value>/some/path/to/your/lib/security/cacerts</value></property> -->
- </bean>
- <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>
- <bean id="ticketCacheBackend" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
- <property name="cacheManager"><ref local="cacheManager"/></property>
- <property name="cacheName" value="ticketCache"/>
- </bean>
- <bean id="statelessTicketCache" class="org.springframework.security.providers.cas.cache.EhCacheBasedTicketCache">
- <property name="cache"><ref local="ticketCacheBackend"/></property>
- </bean>
- <bean id="casAuthoritiesPopulator" class="org.springframework.security.providers.cas.populator.DaoCasAuthoritiesPopulator">
- <property name="userDetailsService"><ref local="jdbcDaoImpl"/></property>
- </bean>
- <bean id="casProxyDecider" class="org.springframework.security.providers.cas.proxy.RejectProxyTickets"/>
- <bean id="serviceProperties" class="org.springframework.security.ui.cas.ServiceProperties">
- <property name="service" value="https://localhost:8443/contacts-cas/j_spring_cas_security_check"/>
- <property name="sendRenew" value="false"/>
- </bean>
- <!-- note logout has little impact, due to CAS reauthentication functionality (it will cause a refresh of the authentication though) -->
- <bean id="logoutFilter" class="org.springframework.security.ui.logout.LogoutFilter">
- <constructor-arg value="/index.jsp"/> <!-- URL redirected to after logout -->
- <constructor-arg>
- <list>
- <bean class="org.springframework.security.ui.logout.SecurityContextLogoutHandler"/>
- </list>
- </constructor-arg>
- </bean>
- <!-- ===================== HTTP CHANNEL REQUIREMENTS ==================== -->
- <!-- Enabled by default for CAS, as a CAS deployment uses HTTPS -->
- <bean id="channelProcessingFilter" class="org.springframework.security.securechannel.ChannelProcessingFilter">
- <property name="channelDecisionManager"><ref local="channelDecisionManager"/></property>
- <property name="filterInvocationDefinitionSource">
- <value>
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- \A/secure/.*\Z=REQUIRES_SECURE_CHANNEL
- \A/j_spring_cas_security_check.*\Z=REQUIRES_SECURE_CHANNEL
- \A.*\Z=REQUIRES_INSECURE_CHANNEL
- </value>
- </property>
- </bean>
- <bean id="channelDecisionManager" class="org.springframework.security.securechannel.ChannelDecisionManagerImpl">
- <property name="channelProcessors">
- <list>
- <ref local="secureChannelProcessor"/>
- <ref local="insecureChannelProcessor"/>
- </list>
- </property>
- </bean>
- <bean id="secureChannelProcessor" class="org.springframework.security.securechannel.SecureChannelProcessor"/>
- <bean id="insecureChannelProcessor" class="org.springframework.security.securechannel.InsecureChannelProcessor"/>
- <!-- ===================== HTTP REQUEST SECURITY ==================== -->
- <bean id="exceptionTranslationFilter" class="org.springframework.security.ui.ExceptionTranslationFilter">
- <property name="authenticationEntryPoint"><ref local="casProcessingFilterEntryPoint"/></property>
- </bean>
- <bean id="casProcessingFilter" class="org.springframework.security.ui.cas.CasProcessingFilter">
- <property name="authenticationManager"><ref local="authenticationManager"/></property>
- <property name="authenticationFailureUrl"><value>/casfailed.jsp</value></property>
- <property name="defaultTargetUrl"><value>/</value></property>
- <property name="filterProcessesUrl"><value>/j_spring_cas_security_check</value></property>
- </bean>
- <bean id="casProcessingFilterEntryPoint" class="org.springframework.security.ui.cas.CasProcessingFilterEntryPoint">
- <property name="loginUrl"><value>https://localhost:8443/cas/login</value></property>
- <property name="serviceProperties"><ref local="serviceProperties"/></property>
- </bean>
- <bean id="httpRequestAccessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
- <property name="allowIfAllAbstainDecisions"><value>false</value></property>
- <property name="decisionVoters">
- <list>
- <ref bean="roleVoter"/>
- </list>
- </property>
- </bean>
- <!-- Note the order that entries are placed against the objectDefinitionSource is critical.
- The FilterSecurityInterceptor will work from the top of the list down to the FIRST pattern that matches the request URL.
- Accordingly, you should place MOST SPECIFIC (ie a/b/c/d.*) expressions first, with LEAST SPECIFIC (ie a/.*) expressions last -->
- <bean id="filterInvocationInterceptor" class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
- <property name="authenticationManager"><ref local="authenticationManager"/></property>
- <property name="accessDecisionManager"><ref local="httpRequestAccessDecisionManager"/></property>
- <property name="objectDefinitionSource">
- <value>
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- \A/secure/super.*\Z=ROLE_WE_DONT_HAVE
- \A/secure/.*\Z=ROLE_SUPERVISOR,ROLE_TELLER
- </value>
- </property>
- </bean>
- <!-- BASIC Regular Expression Syntax (for beginners):
- \A means the start of the string (ie the beginning of the URL)
- \Z means the end of the string (ie the end of the URL)
- . means any single character
- * means null or any number of repetitions of the last expression (so .* means zero or more characters)
- Some examples:
- Expression: \A/my/directory/.*\Z
- Would match: /my/directory/
- /my/directory/hello.html
- Expression: \A/.*\Z
- Would match: /hello.html
- /
- Expression: \A/.*/secret.html\Z
- Would match: /some/directory/secret.html
- /another/secret.html
- Not match: /anothersecret.html (missing required /)
- -->
- </beans>
|