Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. <beans:beans xmlns="http://www.springframework.org/schema/security"
  2. xmlns:beans="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
  6. http://www.springframework.org/schema/security
  7. http://www.springframework.org/schema/security/spring-security-3.1.xsd">
  8.  
  9. <http auto-config='true' use-expressions="true">
  10. <form-login login-page="/login" authentication-failure-url="/loginfailed"
  11. authentication-success-handler-ref="myAuthenticationSuccessHandler"/>
  12. <intercept-url pattern="/admin/**" access="hasRole('Administrator')"/>
  13. <intercept-url pattern="/employee/**"
  14. access="hasAnyRole('Utilizator','Administrator')"/>
  15. <logout logout-success-url="/logout"/>
  16. <access-denied-handler error-page="/login?error=403"/>
  17. </http>
  18. <!-- requires-channel="https" -->
  19.  
  20. <beans:bean id="myAuthenticationSuccessHandler" class="ro.teamnet.utils.CustomAuthHandler"/>
  21.  
  22. <beans:bean id="myPasswordEncoder" class="ro.teamnet.utils.BCryptPasswordEncoder"/>
  23.  
  24. <authentication-manager>
  25. <authentication-provider>
  26. <jdbc-user-service data-source-ref="myDataSource"
  27. users-by-username-query="select email,password, 1 from employee where email=?"
  28. authorities-by-username-query="select e.email, r.authority
  29. from employee e
  30. join employee_role on e.employee_id = employee_role.employee_id
  31. join role r on r.role_id = employee_role.role_id
  32. where e.email = ?"/>
  33. <password-encoder ref="myPasswordEncoder"/>
  34. </authentication-provider>
  35. </authentication-manager>
  36.  
  37.  
  38. </beans:beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement