Advertisement
Guest User

Untitled

a guest
Jul 30th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.92 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3.  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.     xmlns:security="http://www.springframework.org/schema/security"
  5.  xsi:schemaLocation="http://www.springframework.org/schema/beans
  6.      http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  7.   http://www.springframework.org/schema/security
  8.   http://www.springframework.org/schema/security/spring-security-3.1.xsd">
  9.  
  10.  <!-- This is where we configure Spring-Security  -->
  11.  <security:http auto-config="true" use-expressions="true" access-denied-page="/login-fail" >
  12.  
  13.   <security:intercept-url pattern="/login" access="permitAll"/>
  14. <!--  <security:intercept-url pattern="/krams/main/admin" access="hasRole('ROLE_ADMIN')"/>-->
  15.   <security:intercept-url pattern="/" access="hasRole('ROLE_USER')"/>
  16.  
  17.    
  18.   <security:form-login
  19.     login-page="/login"
  20.     authentication-failure-url="/login-fail?error=true"
  21.     default-target-url="/index"/>
  22.    
  23.   <security:logout
  24.     invalidate-session="true"
  25.     logout-success-url="/logout"
  26.     logout-url="/logout"/>
  27.  
  28.  </security:http>
  29.  
  30.  <!-- Declare an authentication-manager to use a custom userDetailsService -->
  31.  <security:authentication-manager>
  32.          <security:authentication-provider user-service-ref="customUserDetailsService">
  33.   <!--         <security:password-encoder ref="passwordEncoder"/>-->
  34.          </security:authentication-provider>
  35.  </security:authentication-manager>
  36.  
  37.  <!-- Use a Md5 encoder since the user's passwords are stored as Md5 in the database
  38. <bean class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" id="passwordEncoder"/>
  39. -->
  40. <!-- A custom service where Spring will retrieve users and their corresponding access levels  -->
  41. <bean id="customUserDetailsService" class="web.service.common.CustomUserDetailsService"/>
  42.  
  43.  
  44.            
  45.  
  46.  
  47. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement