Security配置文件的基本配置及参数名详解
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
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">
<!--不需要认证的页面, 静态资源-->
<security:http pattern="/failer.html" security="none"/>
<security:http pattern="/login.html" security="none"/>
<!--
security:http: 拦截请求配置
auto-config: 这个是一个自动配置过滤器(Filter)的属性, 设置为true,security框架帮我创建login页面,login处理方法
use-expressions:"是否使用spring 的el表达式",如果使用表达式true:access="hasRole('ROLE_USER')"
-->
<security:http auto-config="true" use-expressions="false">
<!-- 配置拦截的请求地址,pattern=/**代表拦截所有请求,
access=ROLE_USER,即访问的用户必须有ROLE_USER的角色才可访问
ROLE_USER写法,ROLE_自定义,须以ROLE_为前缀, 多个以逗号分割,或者
-->
<security:intercept-url pattern="/**" access="ROLE_USER" />
<!--代表以下文件夹的资源都放行-->
<security:http pattern="/css/**" security="none"/>
<security:http pattern="/img/**" security="none"/>
<security:http pattern="/plugins/**" security="none"/>
<!--登陆相关的配置
username-parameter: 登陆请求中发送过来的用户名称的参数名
password-parameter: 登陆请求中发送过来的密码的参数名
login-processing-url: 登陆请求处理的地址,由security处理,帮我们生成好了
login-page: 配置自定义登陆页面 /
default-target-url: 登陆成功后默认跳转页面
authentication-failure-url: 登陆失败后跳转的页面
always-use-default-target: 不管原来访问的是哪个页面,登陆成功后都跳转到default-target-url
-->
<security:form-login username-parameter="username" password-parameter="password"
login-processing-url="/login" login-page="/login.html"
default-target-url="/success.html"
authentication-failure-url="/failer.html"
always-use-default-target="true"
></security:form-login>
<!--<input name="_csrf" type="hidden" value="55ce289b-7be7-4952-b91f-faee1e9fc16e" />-->
<!--关闭跨域请求限制-->
<security:csrf disabled="true"/>
<!-- 退出登陆的配置
logout-url: 退出请求的处理
logout-success-url: 退出成功后跳转的页面
invalidate-session: 让session失效
-->
<security:logout logout-url="/logout" logout-success-url="/login.html" invalidate-session="true"></security:logout>
</security:http>
<!--使用security自带的加密算法-->
<bean id="bCryptPasswordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></bean>
<!--配置授权信息-->
<security:authentication-manager>
<security:authentication-provider>
<security:user-service>
<!--
配置账号密码,以及该账号的角色信息
其中{noop}表示加密的类型,noop则表示不使用任何加密方式
authorities这个用户所拥有的角色
-->
<!--使用自定义认证服务-->
<security:authentication-provider user-service-ref="userService">
<!--指定加密算法-->
<security:password-encoder ref="bCryptPasswordEncoder"/>
</security:user-service>
</security:authentication-provider>
</security:authentication-manager>
</beans>
Security配置文件的基本配置及参数名详解的更多相关文章
- linux下如何配置TCP参数设置详解
设置tcp参数一定要小心谨慎,轻易不要更改线上环境,我贴一下我们线上环境中,sysctl.conf的内容,见文章底部 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tc ...
- SpringCloud Eureka参数配置项详解
SpringCloud Eureka参数配置项详解(转) Eureka涉及到的参数配置项数量众多,它的很多功能都是通过参数配置来实现的,了解这些参数的含义有助于我们更好的应用Eureka的各种功能,下 ...
- Tomcat系列之服务器的安装与配置以及各组件详解
Tomcat系列之服务器的安装与配置以及各组件详解 大纲 一.前言 二.安装与配置Tomcat 三.Tomcat 目录的结构 四.Tomcat 配置文件 注,本文的测试的操作系统为CentOS 6.4 ...
- DAX/PowerBI系列 - 查询参数用法详解(Query Parameter)
PowerBI - 查询参数用法详解(Query Parameter) 很多人都不知道查询参数用来干啥,下面总结一下日常项目中常用的几个查询参数的地方.(本人不太欢hardcode的东西) 使用查询 ...
- (转)CentOS 6下配置软RAID图文详解
CentOS 6下配置软RAID图文详解 原文:http://blog.51cto.com/hujiangtao/1929620 一.RAID 简介 RAID 是英文Redundant Array o ...
- Centos7 配置网络步奏详解
Centos7 配置网络步奏详解 编辑网卡配置文件 vi /etc/sysconfig/network-script/ifcfg-ens01 备注:这里的ens01不是所有系统都叫这个,有的可能叫其他 ...
- C#文件后缀名详解
C#文件后缀名详解 .sln:解决方案文件,为解决方案资源管理器提供显示管理文件的图形接口所需的信息. .csproj:项目文件,创建应用程序所需的引用.数据连接.文件夹和文件的信息. .aspx:W ...
- MySQL高可用架构之Mycat-关于Mycat安装和参数设置详解
MySQL高可用架构之Mycat-关于Mycat安装和参数设置详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Mycat介绍 1>.什么是Mycat Mycat背后是 ...
- java newInstance() 的参数版本与无参数版本详解
newInstance() 的参数版本与无参数版本详解 博客分类: Core Java 通过反射创建新的类示例,有两种方式: Class.newInstance() Constructor.new ...
随机推荐
- python 第三方库的加载与虚拟机的登录
通过pip来安装python模块(pip方式仅需要联网即可,不需要下载其他文件即可实现扩展库哦的安装.升级和卸载).下载python3.5以上的版本(包括3.5),在我的电脑输入cmd进入命令提示符, ...
- .Net Core实践3 配置文件
环境 .netcore2.1 / vs2017 / win10 / centos7 在.netcore项目中读取配置文件,先添加应用程序配置文件App.config.这个是类库项目的配置文件名. Sy ...
- [LVM]创建LVM卷
https://www.cnblogs.com/softidea/p/5147090.html
- 【linux】工作中linux系统常用命令操作整理
1.Linux如何查看端口 使用lsof(list open files)命令,lsof -i:端口号 用于查看某一端口的占用情况,比如查看8000端口使用情况,lsof -i:8000. 或者使用n ...
- 为什么天线的回波损耗以-10dB大小来衡量?
传送门:http://www.eeworld.com.cn/Test_and_measurement/2014/0610/article_9152.html i:对于2端口无损耗网络,可以根据S11的 ...
- Day050--jQuery表单事件 轮播图 插件库 ajax
表单控件的事件 change()表单元素发生改变时触发事件 select()文本元素发生改变时触发事件 submit()表单元素发生改变时触发事件 .focus() 获取焦点 .blur() 释放焦点 ...
- rocketmq 启动和停止命令
A启动server: nohup sh mqnamesrv &A启动broken: nohup sh mqbroker -c /opt/rocketmq432/conf/2m-noslave/ ...
- TF Multi-GPU single input queue
多GPU的数据训练,feed images, labels = cifar10.distorted_inputs() split_images = tf.split(images, FLAGS.num ...
- 计算机网络(HTTP)之客户识别:cookie机制
什么是cookie? 承载用户相关信息的HTTP首部 cookie的工作原理 cookie的缺陷 一.什么是cookie? cookie是由服务器生成,发送给USER-Agent(一般是浏览器),(服 ...
- python中__str__与__repr__的区别
__str__和repr __str__和__repr__都是python的内置方法,都用与将对象的属性转化成人类容易识别的信息,他们有什么区别呢 来看一段代码 from math import hy ...