Guest User

spring-security.xml

a guest
Sep 2nd, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.57 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.    xsi:schemaLocation="http://www.springframework.org/schema/beans
  4.          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  5.          http://www.springframework.org/schema/security
  6.          http://www.springframework.org/schema/security/spring-security-3.1.xsd">
  7.          
  8.          
  9.  
  10.     <bean id="servletContextAttributeExporter" class="org.springframework.web.context.support.ServletContextAttributeExporter">
  11.         <property name="attributes">
  12.             <map>
  13.                 <entry key="AccountsClient" value-ref="accountsClient" />
  14.             </map>
  15.         </property>
  16.     </bean>
  17.  
  18.     <security:authentication-manager alias="authenticationManager">
  19.         <security:authentication-provider ref="clientProvider" />
  20.     </security:authentication-manager>
  21.  
  22.     <!-- urls and security configuration -->
  23.     <security:http pattern="/**" entry-point-ref="accountsEntryPoint">
  24.         <security:custom-filter after="CAS_FILTER" ref="clientFilter" />
  25.         <security:intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" />
  26.     </security:http>
  27.  
  28.     <!-- entry points -->
  29.     <bean id="accountsEntryPoint" class="org.pac4j.springframework.security.web.ClientAuthenticationEntryPoint">
  30.         <property name="client" ref="accountsClient" />
  31.     </bean>
  32.  
  33.     <!-- clients definition -->
  34.     <bean id="accountsClient" class="br.com.accounts.client.AccountsClient">
  35.         <property name="key" value="${accounts.key}" />
  36.         <property name="secret" value="${accounts.secret}" />
  37.         <property name="baseUrl" value="${accounts.baseUrl}" />
  38.     </bean>
  39.  
  40.     <bean id="clients" class="org.pac4j.core.client.Clients">
  41.         <property name="callbackUrl" value="${accounts.callback}" />
  42.         <property name="clients">
  43.             <list>
  44.                 <ref bean="accountsClient" />
  45.             </list>
  46.         </property>
  47.     </bean>
  48.    
  49.     <!-- common to all clients -->
  50.     <bean id="clientFilter" class="org.pac4j.springframework.security.web.ClientAuthenticationFilter">
  51.         <constructor-arg value="/callback"/>
  52.         <property name="clients" ref="clients" />
  53.         <property name="authenticationManager" ref="authenticationManager" />
  54.     </bean>
  55.  
  56.     <bean id="clientProvider" class="org.pac4j.springframework.security.authentication.ClientAuthenticationProvider">
  57.         <property name="clients" ref="clients" />
  58.     </bean>
  59. </beans>
Advertisement
Add Comment
Please, Sign In to add comment