Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <beans:beans xmlns="http://www.springframework.org/schema/security"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
- http://www.springframework.org/schema/security
- http://www.springframework.org/schema/security/spring-security-3.1.xsd">
- <http auto-config='true' use-expressions="true">
- <form-login login-page="/login" authentication-failure-url="/loginfailed"
- authentication-success-handler-ref="myAuthenticationSuccessHandler"/>
- <intercept-url pattern="/admin/**" access="hasRole('Administrator')"/>
- <intercept-url pattern="/employee/**"
- access="hasAnyRole('Utilizator','Administrator')"/>
- <logout logout-success-url="/logout"/>
- <access-denied-handler error-page="/login?error=403"/>
- </http>
- <!-- requires-channel="https" -->
- <beans:bean id="myAuthenticationSuccessHandler" class="ro.teamnet.utils.CustomAuthHandler"/>
- <beans:bean id="myPasswordEncoder" class="ro.teamnet.utils.BCryptPasswordEncoder"/>
- <authentication-manager>
- <authentication-provider>
- <jdbc-user-service data-source-ref="myDataSource"
- users-by-username-query="select email,password, 1 from employee where email=?"
- authorities-by-username-query="select e.email, r.authority
- from employee e
- join employee_role on e.employee_id = employee_role.employee_id
- join role r on r.role_id = employee_role.role_id
- where e.email = ?"/>
- <password-encoder ref="myPasswordEncoder"/>
- </authentication-provider>
- </authentication-manager>
- </beans:beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement