applicationContext.xml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  3. <!--
  4. * Copyright 2004 Acegi Technology Pty Limited
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. *
  19. * $Id$
  20. -->
  21. <beans>
  22. <!-- =================== SECURITY SYSTEM DEFINITIONS ================== -->
  23. <!-- RunAsManager -->
  24. <bean id="runAsManager" class="net.sf.acegisecurity.runas.RunAsManagerImpl">
  25. <property name="key"><value>my_run_as_password</value></property>
  26. </bean>
  27. <!-- ~~~~~~~~~~~~~~~~~~~~ AUTHENTICATION DEFINITIONS ~~~~~~~~~~~~~~~~~~ -->
  28. <!-- This authentication provider accepts any presented TestingAuthenticationToken -->
  29. <bean id="testingAuthenticationProvider" class="net.sf.acegisecurity.providers.TestingAuthenticationProvider"/>
  30. <!-- The authentication manager that iterates through our only authentication provider -->
  31. <bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
  32. <property name="providers">
  33. <list>
  34. <ref bean="testingAuthenticationProvider"/>
  35. </list>
  36. </property>
  37. </bean>
  38. <!-- ~~~~~~~~~~~~~~~~~~~~ AUTHORIZATION DEFINITIONS ~~~~~~~~~~~~~~~~~~~ -->
  39. <!-- An access decision voter that reads ROLE_* configuaration settings -->
  40. <bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter"/>
  41. <!-- A unanimous access decision manager -->
  42. <bean id="accessDecisionManager" class="net.sf.acegisecurity.vote.UnanimousBased">
  43. <property name="allowIfAllAbstainDecisions"><value>false</value></property>
  44. <property name="decisionVoters">
  45. <list>
  46. <ref bean="roleVoter"/>
  47. </list>
  48. </property>
  49. </bean>
  50. <!-- ===================== SECURITY DEFINITIONS ======================= -->
  51. <bean id="attributes" class="org.springframework.metadata.commons.CommonsAttributes"/>
  52. <bean id="objectDefinitionSource" class="net.sf.acegisecurity.intercept.method.MethodDefinitionAttributes">
  53. <property name="attributes"><ref local="attributes"/></property>
  54. </bean>
  55. <!-- We don't validate config attributes, as it's unsupported by MethodDefinitionAttributes -->
  56. <bean id="securityInterceptor" class="net.sf.acegisecurity.intercept.method.MethodSecurityInterceptor">
  57. <property name="validateConfigAttributes"><value>false</value></property>
  58. <property name="authenticationManager"><ref bean="authenticationManager"/></property>
  59. <property name="accessDecisionManager"><ref bean="accessDecisionManager"/></property>
  60. <property name="runAsManager"><ref bean="runAsManager"/></property>
  61. <property name="objectDefinitionSource"><ref bean="objectDefinitionSource"/></property>
  62. </bean>
  63. <bean id="bankService" class="sample.attributes.BankServiceImpl"/>
  64. <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  65. <!-- names of the interceptors that will be applied by the proxy -->
  66. <property name="interceptorNames">
  67. <list>
  68. <value>securityInterceptor</value>
  69. </list>
  70. </property>
  71. <!-- the bean names to automatically generate proxies for -->
  72. <property name="beanNames">
  73. <list>
  74. <value>bankService</value>
  75. </list>
  76. </property>
  77. </bean>
  78. </beans>