Advertisement
Guest User

Untitled

a guest
Aug 6th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.40 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans:beans xmlns="http://www.springframework.org/schema/security"
  3.    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
  4.    xsi:schemaLocation="http://www.springframework.org/schema/security
  5.      http://www.springframework.org/schema/security/spring-security-4.0.xsd
  6.      http://www.springframework.org/schema/beans
  7.      http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
  8.  
  9.      
  10.     <http use-expressions="true">
  11.         <csrf disabled="true"/>
  12.          
  13.         <intercept-url pattern="/" access="permitAll()" />
  14.         <intercept-url pattern="/welcome" access="permitAll()" />
  15.         <intercept-url pattern="/login" access="permitAll()" />
  16.         <intercept-url pattern="/logout" access="permitAll()" />
  17.  
  18.  
  19.         <intercept-url pattern="/userInfo"
  20.            access="hasAnyRole('ROLE_USER', 'ROLE_ADMIN')" />
  21.         <intercept-url pattern="/admin" access="hasRole('ROLE_ADMIN')" />
  22.         <intercept-url pattern="/other/**" access="isAuthenticated()" />
  23.  
  24.         <access-denied-handler error-page="/403" />
  25.  
  26.         <form-login login-page='/login' login-processing-url="/j_spring_security_check"
  27.            default-target-url="/userInfo" always-use-default-target="false"
  28.            authentication-failure-url="/login?error=true" username-parameter="username"
  29.            password-parameter="password" />
  30.  
  31.         <logout logout-url="/logout" logout-success-url="/logoutSuccessfullPage"
  32.            delete-cookies="JSESSIONID" invalidate-session="true" />
  33.  
  34.     </http>
  35.  
  36.     <authentication-manager>
  37.         <authentication-provider>
  38.             <user-service>
  39.                 <user name="user1" password="12345" authorities="ROLE_USER" />
  40.                 <user name="admin1" password="12345" authorities="ROLE_USER, ROLE_ADMIN" />
  41.             </user-service>
  42.         </authentication-provider>
  43.  
  44.  
  45.  
  46.         <!-- authentication from database -->
  47.         <authentication-provider>
  48.             <jdbc-user-service data-source-ref="myDataSource"
  49.                users-by-username-query="select USERNAME,PASSWORD, enabled from USERS where USERNAME=?"
  50.                authorities-by-username-query="Select USERNAME, concat('ROLE_',USER_ROLE) USER_ROLE from USER_ROLES where USERNAME=?" />
  51.         </authentication-provider>
  52.  
  53.     </authentication-manager>
  54.  
  55. </beans:beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement