@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. 服务器Centos7.4 下jdk1.8环境配置、mysql环境搭建,mysql找回(重置)密码看这篇就够了

    最近一直帮我的同学搭建自己的服务器,其中涉及到了以下知识点,经过查询博客资料等方式,再加上多重实践,我成功总结出了完整的配置一个简单服务器环境的步骤: (来自 ZYXS 的CSDN 博客 ,全文地址请 ...

  2. [bzoj2208][Jsoi2010]连通数_bitset_传递闭包floyd

    连通数 bzoj-2208 Jsoi-2010 题目大意:给定一个n个节点的有向图,问每个节点可以到达的点的个数和. 注释:$1\le n\le 2000$. 想法:网上有好多tarjan+拓扑序dp ...

  3. poj —— 1274 The Perfect Stall

    The Perfect Stall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 26274   Accepted: 116 ...

  4. (入门SpringBoot)SpringBoot来临(一)

    .创建独立的Spring应用程序. .嵌入tomcat,Jetty或者Undertow,无需部署war文件; .允许通过Maven来获取starter; .尽可能的自动配置Spring. .提供生产就 ...

  5. 06-js的逻辑结构

    <html> <head> <title>js的逻辑结构和循环结构学习</title> <meta charset="UTF-8&quo ...

  6. oracle索引简单使用

    --查询表索引 select * from user_ind_columns where table_name = upper('HY_PROJECT') and column_name = uppe ...

  7. Chains (链 )

    Indy 中的工作队列系统,调度器,和链引擎都被叫做链. 当使用链的时候,一个基于链的 IOHandler 存储工作项目到有关的工作队列中.在一个工作单元被完成以前,执行这个工作单元的纤程是无法做其它 ...

  8. ajax 请求 get请求成功,post 404 not found

    今天在做express的一个ajax请求的时候发现get请求成功,post 就一直是 404 not found, 研究了半天 才发现是express 的请求方法做了限制,之前一直都是用的 app.g ...

  9. DELL T110II Server如何通过RAID 级别迁移的方式在OMSA下实现磁盘阵列扩容?

    目录: RAID 转移规则说明 操作步骤 本文介绍了 通过RAID 级别转换来实现扩容的方法注意:本文相关RAID的操作,仅供在测试环境里学习和理解戴尔PowerEdge服务器RAID控制卡的功能和使 ...

  10. uva 439 Knight Moves 骑士移动

    这道题曾经写过,bfs.用队列,不多说了,上代码: #include<stdio.h> #include<stdlib.h> #include<string.h> ...