Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <beans:beans xmlns="http://www.springframework.org/schema/security"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/security
- http://www.springframework.org/schema/security/spring-security-4.0.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
- <http use-expressions="true">
- <csrf disabled="true"/>
- <intercept-url pattern="/" access="permitAll()" />
- <intercept-url pattern="/welcome" access="permitAll()" />
- <intercept-url pattern="/login" access="permitAll()" />
- <intercept-url pattern="/logout" access="permitAll()" />
- <intercept-url pattern="/userInfo"
- access="hasAnyRole('ROLE_USER', 'ROLE_ADMIN')" />
- <intercept-url pattern="/admin" access="hasRole('ROLE_ADMIN')" />
- <intercept-url pattern="/other/**" access="isAuthenticated()" />
- <access-denied-handler error-page="/403" />
- <form-login login-page='/login' login-processing-url="/j_spring_security_check"
- default-target-url="/userInfo" always-use-default-target="false"
- authentication-failure-url="/login?error=true" username-parameter="username"
- password-parameter="password" />
- <logout logout-url="/logout" logout-success-url="/logoutSuccessfullPage"
- delete-cookies="JSESSIONID" invalidate-session="true" />
- </http>
- <authentication-manager>
- <authentication-provider>
- <user-service>
- <user name="user1" password="12345" authorities="ROLE_USER" />
- <user name="admin1" password="12345" authorities="ROLE_USER, ROLE_ADMIN" />
- </user-service>
- </authentication-provider>
- <!-- authentication from database -->
- <authentication-provider>
- <jdbc-user-service data-source-ref="myDataSource"
- users-by-username-query="select USERNAME,PASSWORD, enabled from USERS where USERNAME=?"
- authorities-by-username-query="Select USERNAME, concat('ROLE_',USER_ROLE) USER_ROLE from USER_ROLES where USERNAME=?" />
- </authentication-provider>
- </authentication-manager>
- </beans:beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement