SecurityContextHolder, to provide access to the SecurityContext.
SecurityContext: to hold the Authentication and possibly request-specific security information.
Authentication: 表示用户认证信息
GrantedAuthority: 当前用户拥有的权限,通过Authentication的getAuthorities()获取,是一个数组。
UserDetails: 定义了一些可以获取用户名、密码、权限等与认证相关的信息的方法,通过UserDetailsService的loadUserByUsername()方法进行加载。
UserDetailsService: org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl(通过数据库或内存获取UserDetails)
UserDetailsService->UserDetails
UserDetailsService->GrantedAuthority(role)
SecurityContextHolder->SecurityContext->Authentication(principal,)
加载用户dao相关:
UserDetailsService(接口):loadUserByUsername(String username) 子类
UserDetailsManager:(接口)changePassword(String oldPassword, String newPassword),createUser(UserDetails user),deleteUser(String username)等
CachingUserDetailsService:
InMemoryUserDetailsManager:
JdbcDaoImpl:
JdbcUserDetailsManager:
LdapUserDetailsManager:
LdapUserDetailsService:
用户信息相关:
UserDetails:(接口)getAuthorities(),getPassword(),getUsername(),isAccountNonExpired()等
InetOrgPerson:
LdapUserDetailsImpl:
LdapUserDetailsImpl:
Person:UserDetails implementation whose properties are based on the LDAP schema for Person.
User:(类)
认证相关:
Principal:(java.security)equals(Object another),getName()
Authentication:(接口)一旦一个request被认证,Authentication 就会被放入 thread-local SecurityContext managed by the SecurityContextHolder
SecurityContextHolder.getContext().setAuthentication(anAuthentication);显式认证,
Collection<? extends GrantedAuthority> getAuthorities(),getCredentials(), getDetails(),getPrincipal()
UsernamePasswordAuthenticationToken:for simple presentation of a username and password.
RememberMeAuthenticationToken:
OpenIDAuthenticationToken:
...
GrantedAuthority:(接口)getAuthority()该方法返回一个字符串,表示对应权限的字符串表示,如果对应权限不能用字符串表示,则应当返回null。
SimpleGrantedAuthority:为Authentication存放一个代表权限的字符串.
...
AuthenticationManager:(接口)处理一个Authentication request, Authentication authenticate(Authentication authentication)
ProviderManager:通过AuthenticationProvider列表来处理认证请求,List<AuthenticationProvider> getProviders()
authenticate(Authentication authentication)
AuthenticationProvider:(接口)
DaoAuthenticationProvider:从UserDetailsService获取一个user,getUserDetailsService(),
retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) 异常相关:
AuthenticationException: AuthenticationServiceException
过滤器相关:
Filter(javax.servlet):void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
GenericFilterBean
DelegatingFilterProxy:
OncePerRequestFilter:
FilterChainProxy:
AbstractAuthenticationProcessingFilter: attemptAuthentication (request,response),getFailureHandler(),getSuccessHandler()
successfulAuthentication(),unsuccessfulAuthentication()
CasAuthenticationFilter,
OpenIDAuthenticationFilter
UsernamePasswordAuthenticationFilter:getPasswordParameter() ,getUsernameParameter() ,obtainPassword( request) ,setDetails()
ExceptionTranslationFilter:Handles any AccessDeniedException and AuthenticationException thrown within the filter chain.
ConcurrentSessionFilter:determineExpiredUrl(HttpServletRequest request, SessionInformation info) Hander相关:
AuthenticationSuccessHandler:(接口):onAuthenticationSuccess(request,response,authentication)
ForwardAuthenticationSuccessHandler:
SavedRequestAwareAuthenticationSuccessHandler:
SimpleUrlAuthenticationSuccessHandler: Event相关:
InteractiveAuthenticationSuccessEvent
入口:
AuthenticationEntryPoint:
LoginUrlAuthenticationEntryPoint:UsernamePasswordAuthenticationFilter使用ExceptionTranslationFilter来重定向到登录页面
commence (request,response,authException)重定向方法,getLoginFormUrl()
Listener相关:
javax.servlet.http.HttpSessionListener
HttpSessionEventPublisher: sessionCreated(javax.servlet.http.HttpSessionEvent event),
sessionDestroyed(javax.servlet.http.HttpSessionEvent event)
Session相关:
SessionRegistry:(接口):getAllPrincipals() getAllSessions(), getSessionInformation(),registerNewSession()
SessionRegistryImpl:
SessionAuthenticationStrategy:(接口)A
CompositeSessionAuthenticationStrategySessionAuthenticationStrategy that accepts multiple SessionAuthenticationStrategy
implementations to delegate to. Each SessionAuthenticationStrategy is invoked in turn. The invocations are short circuited if any exception, (i.e. SessionAuthenticationException) is thrown.
ConcurrentSessionControlAuthenticationStrategy:控制用户可以同时登录的数量,就是控制一个用户可以同时创建几个session
SessionFixationProtectionStrategy:防止会话固定攻击
RegisterSessionAuthenticationStrategy:register a user with the SessionRegistry after successful Authentication.
匿名认证相关:
AuthenticationProvider
AnonymousAuthenticationProvider:authenticate(Authentication authentication), getKey()
Authentication:
AnonymousAuthenticationToken:Represents an anonymous Authentication,getPrincipal()
GenericFilterBean
AnonymousAuthenticationFilter: createAuthentication(HttpServletRequest request) public String getCurrentUsername()
{ Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof UserDetails)
{ return ((UserDetails) principal).getUsername(); } if (principal instanceof Principal)
{ return ((Principal) principal).getName(); } return String.valueOf(principal); }

spring认证的一些核心类的更多相关文章

  1. Spring源码解析——核心类介绍

    前言: Spring用了这么久,虽然Spring的两大核心:IOC和AOP一直在用,但是始终没有搞懂Spring内部是怎么去实现的,于是决定撸一把Spring源码,前前后后也看了有两边,很多东西看了就 ...

  2. Spring源码解析-核心类之XmlBeanFactory 、DefaultListableBeanFactory

    DefaultListableBeanFactory XmlBeanFactory 继承自 DefaultListableBeanFactory , 而 DefaultListableBeanFact ...

  3. Spring源码解析-核心类之XmlBeanDefinitionReader

    XmlBeanDefinitionReader XML配置文件的读取是 Spring 中重要的功能,因为 Spring 的大部分功能都是以配置作为切入点的,那么我们可以从 XmlBeanDefinit ...

  4. Spring Security(03)——核心类简介

    目录 1.1     Authentication 1.2     SecurityContextHolder 1.3     AuthenticationManager和Authentication ...

  5. Spring Security——核心类简介——获得登录用户的相关信息

    核心类简介 目录 1.1     Authentication 1.2     SecurityContextHolder 1.3     AuthenticationManager和Authenti ...

  6. Java入门到精通——框架篇之Spring源码分析Spring两大核心类

    一.Spring核心类概述. Spring里面有两个最核心的类这是Spring实现最重要的部分. 1.DefaultListableBeanFactory 这个类位于Beans项目下的org.spri ...

  7. 2017.3.31 spring mvc教程(一)核心类与接口

    学习的博客:http://elf8848.iteye.com/blog/875830/ 我项目中所用的版本:4.2.0.博客的时间比较早,11年的,学习的是Spring3 MVC.不知道版本上有没有变 ...

  8. Spring源码分析(1)容器的基本实现——核心类介绍

    bean是Spring中最核心的东西,因为Spring就像是个大水桶,而bean就像是容器中的水,水桶脱离了水便也没什么用处了,那么我们先看看bean的定义. public class MyTestB ...

  9. 【Spring注解驱动开发】AOP核心类解析,这是最全的一篇了!!

    写在前面 昨天二狗子让我给他讲@EnableAspectJAutoProxy注解,讲到AnnotationAwareAspectJAutoProxyCreator类的源码时,二狗子消化不了了.这不,今 ...

随机推荐

  1. Python基础(返回函数)

    #我们在函数lazy_sum中又定义了函数f1,并且,内部函数f1可以引用外部函数lazy_sum的参数和局部变量,当lazy_sum返回函数f1时,相关参数和变量都保存在返回的函数中,这种称为&qu ...

  2. Java 多线程 - 总结概述

    概述 菜鸟教程: Java 给多线程编程提供了内置的支持. 一条线程指的是进程中一个单一顺序的控制流,一个进程中可以并发多个线程,每条线程并行执行不同的任务. 多线程是多任务的一种特别的形式,但多线程 ...

  3. [hdu7013]String Mod

    枚举$a$​​​和$b$​​​​​出现的次数,问题即求$$A_{i,j}=\sum_{p=0}^{L}\sum_{q=0}^{L-p}[n\mid (p-i)][n\mid (q-j)]{L\choo ...

  4. [noi1760]SAM

    建立SAM,求出每一个节点最左边的出现位置(即right集合中的最小元素,在树上dfs即可) 枚举左端点i和右端点j(保证j是最小的满足$s[i,j)$不是$s[0,i)$的子串),维护k表示$s[i ...

  5. 【HTML】标签

    HTML标签 2020-09-08  15:37:37  by冲冲 1. 标签 <!DOCTYPE html> <html> <head> <meta cha ...

  6. [源码解析] PyTorch 分布式(12) ----- DistributedDataParallel 之 前向传播

    [源码解析] PyTorch 分布式(12) ----- DistributedDataParallel 之 前向传播 目录 [源码解析] PyTorch 分布式(12) ----- Distribu ...

  7. .net core 和 WPF 开发升讯威在线客服系统:使用本地IP数据库实现访客来源快速定位,支持国外

    本系列文章详细介绍使用 .net core 和 WPF 开发 升讯威在线客服与营销系统 的过程.本产品已经成熟稳定并投入商用. 免费使用 & 私有化部署:https://kf.shengxun ...

  8. 8.1 k8s使用PV/PVC做数据持久化运行redis服务,数据保存至NFS

    1.制作redis docker镜像 1.1 准备alpine基础镜像 # 下载 docker pull alpine:3.13 # 更改tag docker tag alpine:3.13 192. ...

  9. File与IO基础

    IO流的作用:持久化到磁盘 File类的使用 File类基本概念 文件和文件夹都是用File类来表示. File类是内存层面的对象,内存中创建出来的File对象不一定有一个真实存在的文件或文件夹,但是 ...

  10. Codeforces 1288F - Red-Blue Graph(上下界网络流)

    Codeforces 题面传送门 & 洛谷题面传送门 好久没有写过上下界网络流了,先来一题再说( 首先先假设所有边都是蓝边,那么这样首先就有 \(b\times m\) 的花费,但是这样不一定 ...