spring-security-4.2.1.RELEASE命名空间基本配置(xml)
2016-12-28 14:55
661 查看
spring-security版本号 4.2.1.RELEASE
<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/security"
xmlns:b="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.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> <!-- 不拦截静态资源 -->
<http pattern="/assets/**" security="none" />
<!-- 不拦截自定义登录页面 -->
<http pattern="/view/login" security="none" />
<!-- -->
<http auto-config="true">
<!-- 关闭csrf-->
<csrf disabled="true" />
<!-- 除了排除的路径,其他所有路径需要有ROLE_USER权限的用户才能访问-->
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
<!-- 指定登录页面路径/view/login.html -->
<form-login login-page="/view/login" default-target-url="/index" always-use-default-target="true" />
<!-- 配置退出功能 -->
<logout invalidate-session="true" logout-success-url="/view/login?logout" logout-url="/logout" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="jimi" password="123456" authorities="ROLE_USER, ROLE_ADMIN" />
<user name="bob" password="123456" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</b:beans>
<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/security"
xmlns:b="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.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> <!-- 不拦截静态资源 -->
<http pattern="/assets/**" security="none" />
<!-- 不拦截自定义登录页面 -->
<http pattern="/view/login" security="none" />
<!-- -->
<http auto-config="true">
<!-- 关闭csrf-->
<csrf disabled="true" />
<!-- 除了排除的路径,其他所有路径需要有ROLE_USER权限的用户才能访问-->
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
<!-- 指定登录页面路径/view/login.html -->
<form-login login-page="/view/login" default-target-url="/index" always-use-default-target="true" />
<!-- 配置退出功能 -->
<logout invalidate-session="true" logout-success-url="/view/login?logout" logout-url="/logout" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="jimi" password="123456" authorities="ROLE_USER, ROLE_ADMIN" />
<user name="bob" password="123456" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</b:beans>
相关文章推荐
- Spring4.3.x 浅析xml配置的解析过程(11)——解析aop命名空间之scoped-proxy标签
- 在Spring的XML文件中通过命名空间配置的标签是怎么解析的?
- spring的xml配置文件中命名空间
- [转] Spring4.3.x 浅析xml配置的解析过程(6)——解析context命名空间之property-placeholder和property-override标签
- Spring4.3.x 浅析xml配置的解析过程(6)——解析context命名空间之property-placeholder和property-override标签
- Spring4.3.x 浅析xml配置的解析过程(5)——解析自定义命名空间的标签
- Spring4.3.x 浅析xml配置的解析过程(9)——解析aop命名空间之config标签
- eclipse安装spring tool suite插件便于xml配置文件选择命名空间添加
- Spring--IoC---基本XML的DI---P命名空间设值注入
- Spring4.3.x 浅析xml配置的解析过程(10)——解析aop命名空间之aspectj-autoproxy标签
- Spring4.3.x 浅析xml配置的解析过程(7)——解析context命名空间之annotation-config标签
- Spring--IoC---基本XML的DI---C命名空间设值注入
- Spring4.3.x 浅析xml配置的解析过程(8)——解析context命名空间之component-scan标签
- Spring整合Structs2 的web.xml 基本配置
- Sping的Xml配置命名空间
- struts.xml配置文件中的包,命名空间,默认继承的介绍
- 一个spring 基本知识的微博(怎么加载多个xml、多个property文件、aop配置、监视器)
- 01_spring基本命名空间及各种类型注入方式
- 配置xml时一些jar和命名空间问题,如mvc:annotation-driven
- spring配置文件命名空间读取顺序