applicationContext.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. <beans>
  4. <bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy">
  5. <property name="filterInvocationDefinitionSource">
  6. <value>
  7. CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
  8. PATTERN_TYPE_APACHE_ANT
  9. /login_error.jsp=httpSessionContextIntegrationFilter
  10. /**=httpSessionContextIntegrationFilter, exceptionTranslationFilter, ntlmFilter, filterSecurityInterceptor
  11. </value>
  12. </property>
  13. </bean>
  14. <!-- The first item in the Chain: httpSessionContextIntegrationFilter -->
  15. <bean id="httpSessionContextIntegrationFilter" class="org.springframework.security.context.HttpSessionContextIntegrationFilter">
  16. <property name="context">
  17. <value>org.springframework.security.context.SecurityContextImpl</value>
  18. </property>
  19. </bean>
  20. <!-- the second item in the chain: exceptionTranslationFilter -->
  21. <bean id="exceptionTranslationFilter" class="org.springframework.security.ui.ExceptionTranslationFilter">
  22. <property name="authenticationEntryPoint" ref="ntlmEntryPoint"/>
  23. </bean>
  24. <!-- the third item in the chain: ntlmFilter -->
  25. <bean id="ntlmFilter" class="org.springframework.security.ui.ntlm.NtlmProcessingFilter">
  26. <property name="defaultDomain" value="YOURDOMAIN"/>
  27. <!-- It is better to use a WINS server if available over a specific domain controller
  28. <property name="domainController" value="FOO"/> -->
  29. <property name="netbiosWINS" value="192.168.0.3"/>
  30. <property name="authenticationManager" ref="providerManager"/>
  31. </bean>
  32. <bean id="providerManager" class="org.springframework.security.providers.ProviderManager">
  33. <property name="providers">
  34. <list>
  35. <ref local="daoAuthenticationProvider"/>
  36. </list>
  37. </property>
  38. </bean>
  39. <bean id="daoAuthenticationProvider" class="org.springframework.security.providers.dao.DaoAuthenticationProvider">
  40. <property name="userDetailsService">
  41. <ref local="memoryUserDetailsService"/>
  42. </property>
  43. </bean>
  44. <!-- NOTE: You will need to write a custom UserDetailsService in most cases -->
  45. <bean id="memoryUserDetailsService" class="org.springframework.security.userdetails.memory.InMemoryDaoImpl">
  46. <property name="userMap">
  47. <value>jdoe=PASSWORD,ROLE_USER</value>
  48. </property>
  49. </bean>
  50. <!-- the fourth item in the chain: filterSecurityInterceptor -->
  51. <bean id="filterSecurityInterceptor" class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
  52. <property name="authenticationManager"><ref local="providerManager"/></property>
  53. <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
  54. <property name="objectDefinitionSource">
  55. <value>
  56. CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
  57. PATTERN_TYPE_APACHE_ANT
  58. /**=ROLE_USER
  59. </value>
  60. </property>
  61. </bean>
  62. <!-- authenticationManager defined above -->
  63. <bean id="accessDecisionManager" class="org.springframework.security.vote.UnanimousBased">
  64. <property name="allowIfAllAbstainDecisions">
  65. <value>false</value>
  66. </property>
  67. <property name="decisionVoters">
  68. <list>
  69. <ref local="roleVoter"/>
  70. </list>
  71. </property>
  72. </bean>
  73. <bean id="roleVoter" class="org.springframework.security.vote.RoleVoter"/>
  74. <bean id="ntlmEntryPoint" class="org.springframework.security.ui.ntlm.NtlmProcessingFilterEntryPoint">
  75. <property name="authenticationFailureUrl" value="/login_error.jsp"/>
  76. </bean>
  77. <!-- Done with the chain -->
  78. <!-- This bean automatically receives AuthenticationEvent messages from DaoAuthenticationProvider -->
  79. <bean id="loggerListener" class="org.springframework.security.event.authentication.LoggerListener"/>
  80. </beans>