springSecurity认证管理器 springSecurity认证管理器 SpringSecurity负责验证用户身份需要用到认证管理器(AuthenticationManager)。 认证管理器的接口很简单,只有一个方法,将用户名密码传入此认证器,如果不报错则为认证通过。 1234public interface AuthenticationManager { Authentication authentic 2020-07-20 #springboot #springSecurity #AuthenticationManager
springSecurity限制多用户登录 springSecurity限制多用户登录 限制用户多次登录的原理就是,每次用户登录时,将用户的sessionId存储起来,下次在登录时检查已经存在的sessionId列表里此用户登陆了几次,就能据此做处理了。 最简单的就像这样设置,这样做以后后面登录的会将前面最近未使用的session挤掉。 1http.sessionManagement().maximumSessions(1) 2020-07-20 #springboot #springSecurity #AuthenticationManager
springSecurity 退出登录 springSecurity 退出登录 这个filter比较简单,它要做的事情就是拦截退出登录的请求,执行退出逻辑,执行退出完成逻辑。 1234567891011121314151617181920212223public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws I 2020-07-15 #springboot #springSecurity #logoutFilter
springSecurity 防止csrf攻击 springSecurity 防止csrf攻击 启用csrf filter。 123456public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exceptio 2020-07-14 #springboot #springSecurity #csrf
maven utf8控制台下乱码 maven命令 GitBash控制台下乱码 添加环境变量 键 MAVEN_OPTS 值 -Dfile.encoding=UTF-8 重启GItBash,再试。 2020-07-09 #maven
git rebase使用场景 git rebase使用场景 TOC{:toc} 场景1,多用户对同一远程仓库进行提交A,B同时从仓库pull下来代码,此时两人代码是一样的。 首先是A,进行了修改 123//修改文件a.txtgit add a.txtgit commit -m "修复bug1" 此时A的log是:  此时会进行Url解码 2020-06-19 #java #乱码问题
Spring Bean初始化过程 Spring Bean初始化过程 本文讨论Spring容器下的Bean初始化过程。 创建SpringBoot项目,创建如下类,通过它研究Bean的初始化过程。 123456789101112@Componentpublic class Cat implements ApplicationContextAware { public Cat() { Syste 2020-06-15 #java #spring #Bean初始化过程