applicationContext-acegi-security-new-namespaces.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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:security="http://www.springframework.org/schema/security"
  5. xmlns:util="http://www.springframework.org/schema/util"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  7. http://www.springframework.org/schema/util http://www.springframework.org/schema/beans/spring-util-2.0.xsd
  8. http://www.springframework.org/schema/security file:/Users/vpuri/interface21/acegisecurity/trunk/acegisecurity/core/src/main/resources/org/acegisecurity/config/spring-security-2.0.xsd">
  9. <!--
  10. - A simple "base bones" Acegi Security configuration.
  11. -
  12. - The sample includes the "popular" features that people tend to use.
  13. - Specifically, form authentication, remember-me, and anonymous processing.
  14. - Other features aren't setup, as these can be added later by inserting
  15. - the relevant XML fragments as specified in the Reference Guide.
  16. -
  17. - To assist new users, the filters specified in the FilterChainProxy are
  18. - declared in the application context in the same order. Collaborators
  19. - required by those filters are placed at the end of the file.
  20. -
  21. - $Id: applicationContext-acegi-security.xml 1513 2006-05-29 13:32:12Z benalex $
  22. -->
  23. <bean id="filterChainProxy"
  24. class="org.acegisecurity.util.FilterChainProxy">
  25. <property name="filterInvocationDefinitionSource">
  26. <value>
  27. CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
  28. PATTERN_TYPE_APACHE_ANT
  29. /**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor
  30. </value>
  31. </property>
  32. </bean>
  33. <!-- sessionCreation defaults to ifRequired(true) always(true) never(false) . -->
  34. <security:session-context-integration
  35. id="httpSessionContextIntegrationFilter" sessionCreation="ifRequired" />
  36. <!-- If LogoutFilter does not have setHandlers populated, introspect app ctx for LogoutHandlers, using Ordered (if present, otherwise assume Integer.MAX_VALUE) -->
  37. <!-- The logoutUrl and redirectAfterLogout are both optional and default to that shown -->
  38. <security:logout-support id="logoutFilter"
  39. redirectAfterLogoutUrl="/index.jsp" />
  40. <security:authentication-remember-me-services
  41. id="rememberMeServices" key="someValue" />
  42. <bean id="SecurityContextLogoutHandler"
  43. class="org.acegisecurity.ui.logout.SecurityContextLogoutHandler" />
  44. <!-- the URLs are all mandatory and have no defaults (well, except authenticationUrl) -->
  45. <security:authentication-form id="authenticationProcessinFilter"
  46. authenticationUrl="/j_acegi_security_check" defaultTargetUrl="/"
  47. errorFormUrl="/acegilogin.jsp?login_error=1" />
  48. <!-- make it optional, if not supplied autodetect all auth-providers from app ctx, using Ordered to resolve their order -->
  49. <security:authentication-mechanism id="authenticationManager" />
  50. <!-- dao authentication provider "authenticationRepository" -->
  51. <security:authentication-repository id="daoAuthenticationProvider" />
  52. <bean id="securityContextHolderAwareRequestFilter"
  53. class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter" />
  54. <!-- makes the filter, but does little else, as it auto-detects everything -->
  55. <security:authentication-remember-me-filter id="rememberMeFilter" />
  56. <bean id="anonymousProcessingFilter"
  57. class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
  58. <property name="key" value="changeThis" />
  59. <property name="userAttribute"
  60. value="anonymousUser,ROLE_ANONYMOUS" />
  61. </bean>
  62. <!-- Basically accessDeniedUrl is optional, we if unspecified impl will auto-detect any AccessDeniedHandler in ctx and use it;
  63. alternately if there are > 1 such handlers, we can nominate the one to use via accessDeniedBeanRef; provide nested elements for
  64. other props; i do not mind if you move the access denied stuff to a sub-element -->
  65. <security:exception-translation id="exceptionTranslationFilter">
  66. <security:entry-point
  67. entryPointBeanRef="authenticationEntryPoint" />
  68. </security:exception-translation>
  69. <bean id="authenticationEntryPoint"
  70. class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
  71. <property name="loginFormUrl" value="/acegilogin.jsp" />
  72. <property name="forceHttps" value="false" />
  73. </bean>
  74. <bean id="accessDeniedHandler"
  75. class="org.acegisecurity.ui.AccessDeniedHandlerImpl">
  76. <property name="errorPage" value="/accessDenied.jsp" />
  77. </bean>
  78. <bean id="filterInvocationInterceptor"
  79. class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
  80. <property name="authenticationManager"
  81. ref="authenticationManager" />
  82. <property name="accessDecisionManager">
  83. <bean class="org.acegisecurity.vote.AffirmativeBased">
  84. <property name="allowIfAllAbstainDecisions"
  85. value="false" />
  86. <property name="decisionVoters">
  87. <list>
  88. <bean class="org.acegisecurity.vote.RoleVoter" />
  89. <bean
  90. class="org.acegisecurity.vote.AuthenticatedVoter" />
  91. </list>
  92. </property>
  93. </bean>
  94. </property>
  95. <property name="objectDefinitionSource">
  96. <value>
  97. CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
  98. PATTERN_TYPE_APACHE_ANT
  99. /secure/extreme/**=ROLE_SUPERVISOR
  100. /secure/**=IS_AUTHENTICATED_REMEMBERED
  101. /**=IS_AUTHENTICATED_ANONYMOUSLY
  102. </value>
  103. </property>
  104. </bean>
  105. <!--<bean id="authenticationManager"
  106. class="org.acegisecurity.providers.ProviderManager">
  107. <property name="providers">
  108. <list>
  109. <ref local="daoAuthenticationProvider" />
  110. <bean
  111. class="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider">
  112. <property name="key" value="changeThis" />
  113. </bean>
  114. <bean
  115. class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider">
  116. <property name="key" value="changeThis" />
  117. </bean>
  118. </list>
  119. </property>
  120. </bean>-->
  121. <bean id="userCache"
  122. class="org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">
  123. <property name="cache">
  124. <bean
  125. class="org.springframework.cache.ehcache.EhCacheFactoryBean">
  126. <property name="cacheManager">
  127. <bean
  128. class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" />
  129. </property>
  130. <property name="cacheName" value="userCache" />
  131. </bean>
  132. </property>
  133. </bean>
  134. <!-- UserDetailsService is the most commonly frequently Acegi Security interface implemented by end users -->
  135. <security:principal-repository id="userDetailsService">
  136. <security:properties resource="/WEB-INF/users.properties" />
  137. </security:principal-repository>
  138. <!-- This bean is optional; it isn't used by any other bean as it only listens and logs -->
  139. <bean id="loggerListener"
  140. class="org.acegisecurity.event.authentication.LoggerListener" />
  141. </beans>