Want more features on Pastebin? Sign Up, it's FREE!
Guest

Application Context

By: a guest on Dec 7th, 2011  |  syntax: XML  |  size: 3.75 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3.         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.         xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  5.         xmlns:context="http://www.springframework.org/schema/context"
  6.         xmlns:security="http://www.springframework.org/schema/security"
  7.         xsi:schemaLocation="
  8.                 http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  9.                 http://www.springframework.org/schema/jdbc     http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
  10.                 http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd
  11.                 http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
  12.         ">
  13.        
  14.         <security:global-method-security pre-post-annotations="enabled">
  15.         <security:expression-handler ref="securityExpressionHandler"/>
  16.     </security:global-method-security>
  17.        
  18.     <!-- Configure SpEL expressions handler for security annotations -->
  19.     <bean id="securityExpressionHandler"
  20.          class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
  21.         <!-- Set role hierarchy to use -->
  22.         <!-- <property name="roleHierarchy" ref="roleHierarchy" /> -->
  23.         <!-- Enable SpEL hasPermission expression evaluation -->
  24.         <property name="permissionEvaluator" ref="aclPermissionEvaluator" />
  25.     </bean>
  26.    
  27.     <!-- Evaluates hasPermission expression -->
  28.     <bean id="aclPermissionEvaluator" class="org.springframework.security.acls.AclPermissionEvaluator">
  29.         <!-- Link to actual ACL Service -->
  30.         <constructor-arg ref="aclService" />
  31.     </bean>
  32.    
  33.     <!-- Retrieves, modifies and strores access control lists -->
  34.     <bean id="aclService" class="org.springframework.security.acls.jdbc.JdbcAclService">
  35.         <constructor-arg ref="dataSource" />
  36.         <constructor-arg ref="lookupStrategy" />
  37.     </bean>
  38.    
  39.     <!-- Responsible for efficient retrieval of ACLs from database -->
  40.     <bean id="lookupStrategy" class="org.springframework.security.acls.jdbc.BasicLookupStrategy">
  41.         <constructor-arg ref="dataSource" />
  42.         <constructor-arg ref="aclCache" />
  43.         <constructor-arg ref="aclAuthorizationStrategy" />
  44.         <constructor-arg ref="aclAuditLogger" />
  45.     </bean>
  46.    
  47.     <!-- ACL permission factory -->
  48.     <bean id="permissionFactory" class="org.springframework.security.acls.domain.DefaultPermissionFactory" />
  49.      
  50.     <!-- Caching support for ACLs -->
  51.     <bean id="aclCache" class="com.tielev.acltest.security.NullAclCache" />
  52.    
  53.     <!-- ACL Audit Logger -->
  54.     <bean class="org.springframework.security.acls.domain.ConsoleAuditLogger" id="aclAuditLogger"/>
  55.  
  56.     <!-- Authorization for ACLs administration setup -->
  57.     <bean id="aclAuthorizationStrategy" class="org.springframework.security.acls.domain.AclAuthorizationStrategyImpl">
  58.         <constructor-arg>
  59.             <list>
  60.                 <bean class="org.springframework.security.core.authority.GrantedAuthorityImpl">
  61.                     <constructor-arg value="ROLE_ADMIN" />
  62.                 </bean>
  63.                 <bean class="org.springframework.security.core.authority.GrantedAuthorityImpl">
  64.                     <constructor-arg value="ROLE_ADMIN" />
  65.                 </bean>
  66.                 <bean class="org.springframework.security.core.authority.GrantedAuthorityImpl">
  67.                     <constructor-arg value="ROLE_ADMIN" />
  68.                 </bean>
  69.             </list>
  70.         </constructor-arg>
  71.     </bean>
  72.    
  73.     <jdbc:embedded-database id="dataSource">
  74.                 <jdbc:script location="classpath:acl-schema.sql"/>
  75.         </jdbc:embedded-database>
  76. </beans>
  77.  
clone this paste RAW Paste Data