摘要:
##HttpSecurity HttpSecurity 也是 Spring Security 中的重要一环。我们平时所做的大部分 Spring Security 配置也都是基于 HttpSecurity 来配置的。因此我们有必要从源码的角度来理解下 HttpSecurity 到底干了啥? 首先我们来 阅读全文
摘要:
##(一) AuthenticationProvider实现类 经过之前的认证流程分析,我们知道了认证主要是在AuthenticationProvider中的authenticate中完成的,那么我们只需要在这个方法中添加一个验证码校验即可 //新建一个AuthenticationProvider实 阅读全文
摘要:
在我们进行登录时,如果用户数据来自不同的表,在一个表中查不到就去另一个表查,我们就需要配置多个数据源 经过(五)的分析,我们知道了认证需要经过ProviderManager,ProviderManager对应多个AuthenticationProvider,而每个AuthenticationProv 阅读全文
摘要:
Spring Security整个流程如上图所示,下面我们分别介绍一下各个组件 ##AbstracAuthenticationProcessingFilter AbstracAuthenticationProcessingFilter是一个抽象类,如果使用账号密码的方式登录,AbstracAuthe 阅读全文
摘要:
登录成功后,如果我们没有使用框架的话,用户信息会保存在HttpSession中,Spring Security实质是对HttpSession进行了封装,我们可以直接从HttpSession中获取信息,也可以采用Spring Security提供的方法 (1)从SecurityContextHolde 阅读全文
摘要:
@Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter{ @Override protected void configure(HttpSecurity http) throws Exceptio 阅读全文
摘要:
##快速入门 1.引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> 2.编写control 阅读全文
摘要:
原理 是基于责任链的方式 WebAsyncManagerIntegrationFilter:将 Security 上下文与 Spring Web 中用于处理异步请求映射的 WebAsyncManager 进行集成。 SecurityContextPersistenceFilter:在每次请求处理之前 阅读全文
摘要:
###zookeeper(一般不用) 1.springcloud整合zookeeper(注意必须引入springcloud) <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-star 阅读全文