@Configuration
public static class WebSecurityConfigurer extends WebSecurityConfigurerAdapter{ @Override
protected void configure(HttpSecurity http) throws Exception {
http
.formLogin()
.and()
.logout()
.invalidateHttpSession(true)
.logoutUrl("/logout").logoutSuccessUrl("/")
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
.and()
.authorizeRequests()
// .antMatchers("/test").permitAll()
// .antMatchers("/**").authenticated()
.anyRequest().authenticated();
}
}

Spring-security配置代码的更多相关文章

  1. spring boot 之 spring security 配置

    Spring Security简介 之前项目都是用shiro,但是时过境迁,spring security变得越来越流行.spring security的前身是Acegi, acegi 我也玩过,那都 ...

  2. spring security 配置多个AuthenticationProvider

    前言 发现很少关于spring security的文章,基本都是入门级的,配个UserServiceDetails或者配个路由控制就完事了,而且很多还是xml配置,国内通病...so,本文里的配置都是 ...

  3. Spring学习日志之Spring Security配置

    依赖引入 <dependency> <groupId>org.springframework.security</groupId> <artifactId&g ...

  4. Spring Security配置

    更加优雅地配置Spring Securiy(使用Java配置和注解):https://www.cnblogs.com/xxzhuang/p/5960001.html 采用注解方式实现security: ...

  5. Spring Security配置个过滤器也这么卷

    以前胖哥带大家用Spring Security过滤器实现了验证码认证,今天我们来改良一下验证码认证的配置方式,更符合Spring Security的设计风格,也更加内卷. CaptchaAuthent ...

  6. spring mvc 和spring security配置 web.xml设置

    <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmln ...

  7. 通过 Spring Security配置 解决X-Frame-Options deny 造成的页面空白 iframe调用问题

    spring Security下,X-Frame-Options默认为DENY,非Spring Security环境下,X-Frame-Options的默认大多也是DENY,这种情况下,浏览器拒绝当前 ...

  8. spring mvc 和spring security配置 spring-servlet.xml和spring-security.xml设置

    spring-servlet.xml配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmln ...

  9. 最简单的Spring Security配置示例

    代码结构: pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns=&qu ...

  10. WebFlux Spring Security配置

    最小化可运行配置 package com.terwergreen.bugucms.config; import org.apache.commons.logging.Log; import org.a ...

随机推荐

  1. P1230 智力大冲浪 洛谷

    https://www.luogu.org/problem/show?pid=1230 题目描述 小伟报名参加中央电视台的智力大冲浪节目.本次挑战赛吸引了众多参赛者,主持人为了表彰大家的勇气,先奖励每 ...

  2. ubuntu忘记root密码的解决办法

    ubuntu忘记密码,不需要重装系统即可重新设置root密码,以下是步骤: 1)在系统一启动时,按ESC键,目的是为了出现选单页面 2) 当看到选单页面时,此时按下[e] 这个键,此时会进入grub ...

  3. Mybatis 最强大的动态sql <where>标签

    <select id="findActiveBlogLike" resultType="Blog"> SELECT * FROM BLOG WHER ...

  4. python比较大小

    1.python的比较总是检查复合对象的所有部分,直到可以得出结果为止. 2.会自动遍历嵌套的所有数据结构,有多深走多深,首次发现的差值将决定比较的结果 3.== :操作符测试值的相等性 4.is : ...

  5. 剑指Offer - 两个链表第一个公共节点

    https://www.nowcoder.com/practice/6ab1d9a29e88450685099d45c9e31e46?tpId=13&tqId=11189&tPage= ...

  6. 使用Maven对JAVA程序打包-带主类、带依赖

    使用Maven对JAVA程序打包-带主类.带依赖 http://blog.csdn.net/strongyoung88/article/details/54097830

  7. win7 多用户远程登录

    win7多用户远程登录 远程桌面服务使局域网(LAN)上的计算机可以连接到服务器(也称为远程计算机)并运行位于服务器上的程序.这可以只需要在1台机器上安装应用程序,其他机器共享使用.远程桌面连接使用远 ...

  8. CSS 全部的列表样式类型

    <html> <head> <style type="text/css"> ul.none {list-style-type: none} ul ...

  9. C++开发人脸性别识别教程(16)——视频人脸性别识别

    在之前的博文中我们已经可以顺利驱动摄像头来採集源图像.在这篇博文中将正式为其加入性别识别的代码,实现摄像头视频的人脸性别识别. 一.人脸检測 在得到摄像头採集的源图像之后,首先要做的就是对其进行人脸检 ...

  10. Mariadb 主从

    一 mariadb主从多用于网站架构,因为该主从的同步机制是异步的,数据的同步有一定延迟,也就是说有可能会造成数据的丢失,但是性能比较好,因此网站大多数用的是主从架构的数据库,读写分离必须基于主从架构 ...