要实现退出登录的功能我们需要在 http 元素下定义 logout 元素,这样 Spring Security 将自动为我们添加用于处理退出登录的过滤器 LogoutFilter 到 FilterChain。

当我们指定了 http 元素的 auto-config 属性为 true 时 logout 定义是会自动配置的,

此时我们默认退出登录的 URL 为 “/j_spring_security_logout”,可以通过 logout 元素的 logout-url 属性来改变退出登录的默认地址。

   <security:logout logout-url="/logout.do"/>

此外,我们还可以给 logout 指定如下属性:

属性名 作用
invalidate-session 表示是否要在退出登录后让当前 session 失效,默认为 true。
delete-cookies 指定退出登录后需要删除的 cookie 名称,多个 cookie 之间以逗号分隔。
logout-success-url 指定成功退出登录后要重定向的 URL。需要注意的是对应的 URL 应当是不需要登录就可以访问的。
success-handler-ref 指定用来处理成功退出登录的 LogoutSuccessHandler 的引用。

Spring Security 入门(1-3-3)Spring Security - logout 退出登录的更多相关文章

  1. Spring Security 入门(1-6-1)Spring Security - 配置文件解析和访问请求处理

    1.在pom.xml中添加maven坐标 <dependency> <groupId>org.springframework.security</groupId> ...

  2. Spring Security 入门(1-7)Spring Security - Session管理

    参考链接:https://xueliang.org/article/detail/20170302232815082 session 管理 Spring Security 通过 http 元素下的子元 ...

  3. Spring Security 入门(1-3-5)Spring Security - remember me!

    Remember-Me 功能 概述 Remember-Me 是指网站能够在 Session 之间记住登录用户的身份,具体来说就是我成功认证一次之后在一定的时间内我可以不用再输入用户名和密码进行登录了, ...

  4. Spring Security 入门(1-6-2)Spring Security - 内置的filter顺序、自定义filter、http元素和对应的filterChain

    Spring Security 的底层是通过一系列的 Filter 来管理的,每个 Filter 都有其自身的功能,而且各个 Filter 在功能上还有关联关系,所以它们的顺序也是非常重要的. 1.S ...

  5. Spring Security 入门(1-3-2)Spring Security - http元素 - intercept-url配置

    http元素下可以配置登录页面,也可以配置 url 拦截. 1.直接配置拦截url和对应的访问权限 <security:http use-expressions="false" ...

  6. Spring Security 入门(1-4-2)Spring Security - 认证过程之AuthenticationProvider的扩展补充说明

    1.用户信息从数据库获取 通常我们的用户信息都不会向第一节示例中那样简单的写在配置文件中,而是从其它存储位置获取,比如数据库.根据之前的介绍我们知道用户信息是通过 UserDetailsService ...

  7. Spring Security 入门(1-2)Spring Security - 从 配置例子例子 开始我们的学习历程

    1.Spring Security 的配置文件 我们需要为 Spring Security 专门建立一个 Spring 的配置文件,该文件就专门用来作为 Spring Security 的配置. &l ...

  8. Spring Security 入门(3-11)Spring Security 的使用-自定义登录验证和回调地址

    配置文件 security-ns.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmln ...

  9. Spring Security入门(2-1)Spring Security - 重要的过滤器

    1.自定义的filter机制 如果要对Web资源进行保护,最好的办法莫过于Filter,要想对方法调用进行保护,最好的办法莫过于AOP. Acegi对Web资源的保护,就是靠Filter实现的.Ace ...

随机推荐

  1. P2P技术简介

    P2P技术简介 NAT( Network Address Translation)穿越(俗称打洞)技术 前言: p2p已经存在于我们生活的方方面面:我们通过下载在工具(比如迅雷,bitorent,各种 ...

  2. 使用Dreamweaver正则表达式替换href中的内容

    在Dreamweaver中使用正则表达式替换href中的内容,就像下面这些href中的内容复杂多样的情况下,href="/html/u.html",href="/tuho ...

  3. 题目1032:ZOJ

    题目描述: 读入一个字符串,字符串中包含ZOJ三个字符,个数不一定相等,按ZOJ的顺序输出,当某个字符用完时,剩下的仍然按照ZOJ的顺序输出. 输入: 题目包含多组用例,每组用例占一行,包含ZOJ三个 ...

  4. Centos搭建开发环境,PHP7+ Nginx1.12+ Mysql5.7

    1.更新yum源 yum -y update 2. 安装 epel-release yum install epel-release -y 检测安装成功:yum search nginx  结果含有: ...

  5. Git分支(2/5) -- Fast Forward 合并

    快捷操作: 切换并创建分支: git checkout -b 分支名. git checkout -b some-change 然后我打开某个文件(index.html)修改一下标题. Commit之 ...

  6. Intel 移位指令的陷阱(转)

    今天发现了一个Intel逻辑左移指令shl的一个bug.   逻辑左移的概念是对给定的目的操作数左移COUNT次,每次移位时最高位移入标志位CF中,最低位补零. 其中OPRD1为目的操作数, 可以是通 ...

  7. select子句和三种子查询

    一.select子句 五种子句 Where.group by.having.order by.limit Where.group by.having.order by.limit运用的这个顺序不能变 ...

  8. 数据库操作sql

    一.把从另外一张表里查到的值插入到前表: 1. 表结构完全一样 insert into 表1 select * from 表2 2. 表结构不一样(这种情况下得指定列名) insert into 表1 ...

  9. eventProxyAPI(转)

    EventProxy 仅仅是一个很轻量的工具,但是能够带来一种事件式编程的思维变化.有几个特点: 利用事件机制解耦复杂业务逻辑 移除被广为诟病的深度callback嵌套问题 将串行等待变成并行等待,提 ...

  10. python基础学习笔记二之列表

    1.列表 ①列表的创建: ②列表的查询(索引): ③列表的切片操作: 此处要注意到:返回索引0到3的元素,顾头不顾尾. ④列表的增加: s.append()  #直接在结尾追加 s.insert()  ...