spring secutiry3 最简单配置

 

  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"  
  4.        xmlns:beans="http://www.springframework.org/schema/beans"  
  5.        xsi:schemaLocation="  
  6.        http://www.springframework.org/schema/beans  
  7.        http://www.springframework.org/schema/beans/spring-beans.xsd  
  8.        http://www.springframework.org/schema/security  
  9.        http://www.springframework.org/schema/security/   
  10.               spring-security-3.0.xsd">  
  11.   <http auto-config="true">  
  12.     <intercept-url pattern="/*" access="ROLE_USER"/>  
  13.   </http>  
  14.   <authentication-manager alias="authenticationManager">  
  15.     <authentication-provider>  
  16.       <user-service>  
  17.         <user authorities="ROLE_USER" name="guest" password="guest"/>  
  18.       </user-service>  
  19.     </authentication-provider>  
  20.   </authentication-manager>   
  21. </beans:beans>  
Web.xml

  1. <filter>  
  2.   <filter-name>springSecurityFilterChain</filter-name>  
  3.   <filterclass>  
  4.     org.springframework.web.filter.DelegatingFilterProxy  
  5.   </filter-class>  
  6. </filter>  
  7. <filter-mapping>  
  8.   <filter-name>springSecurityFilterChain</filter-name>  
  9.   <url-pattern>/*</url-pattern>  
  10. </filter-mapping>  

你可能感兴趣的:(spring)