applicationContext-security.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. - Application context containing authentication, channel
  4. - security and web URI beans.
  5. -
  6. - Only used by "filter" artifact.
  7. -
  8. - $Id: applicationContext-acegi-security.xml 1425 2006-04-28 06:43:50Z benalex $
  9. -->
  10. <b:beans xmlns="http://www.springframework.org/schema/security"
  11. xmlns:b="http://www.springframework.org/schema/beans"
  12. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  13. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  14. http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
  15. <http auto-config="true" realm="Contacts Realm">
  16. <intercept-url pattern="/" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
  17. <intercept-url pattern="/index.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
  18. <intercept-url pattern="/hello.htm" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
  19. <intercept-url pattern="/login.jsp*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
  20. <intercept-url pattern="/switchuser.jsp" access="ROLE_SUPERVISOR"/>
  21. <intercept-url pattern="/j_spring_security_switch_user" access="ROLE_SUPERVISOR"/>
  22. <intercept-url pattern="/**" access="ROLE_USER"/>
  23. <form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?login_error=1"/>
  24. <logout logout-success-url="/index.jsp"/>
  25. </http>
  26. <authentication-provider>
  27. <password-encoder hash="md5"/>
  28. <jdbc-user-service data-source-ref="dataSource"/>
  29. </authentication-provider>
  30. <!-- Automatically receives AuthenticationEvent messages -->
  31. <b:bean id="loggerListener" class="org.springframework.security.event.authentication.LoggerListener"/>
  32. <!-- Filter used to switch the user context. Note: the switch and exit url must be secured
  33. based on the role granted the ability to 'switch' to another user -->
  34. <!-- In this example 'rod' has ROLE_SUPERVISOR that can switch to regular ROLE_USER(s) -->
  35. <b:bean id="switchUserProcessingFilter" class="org.springframework.security.ui.switchuser.SwitchUserProcessingFilter" autowire="byType">
  36. <custom-filter position="SWITCH_USER_FILTER"/>
  37. <b:property name="targetUrl" value="/secure/index.htm"/>
  38. </b:bean>
  39. </b:beans>