spring认证的一些核心类
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认证的一些核心类的更多相关文章
- Spring源码解析——核心类介绍
前言: Spring用了这么久,虽然Spring的两大核心:IOC和AOP一直在用,但是始终没有搞懂Spring内部是怎么去实现的,于是决定撸一把Spring源码,前前后后也看了有两边,很多东西看了就 ...
- Spring源码解析-核心类之XmlBeanFactory 、DefaultListableBeanFactory
DefaultListableBeanFactory XmlBeanFactory 继承自 DefaultListableBeanFactory , 而 DefaultListableBeanFact ...
- Spring源码解析-核心类之XmlBeanDefinitionReader
XmlBeanDefinitionReader XML配置文件的读取是 Spring 中重要的功能,因为 Spring 的大部分功能都是以配置作为切入点的,那么我们可以从 XmlBeanDefinit ...
- Spring Security(03)——核心类简介
目录 1.1 Authentication 1.2 SecurityContextHolder 1.3 AuthenticationManager和Authentication ...
- Spring Security——核心类简介——获得登录用户的相关信息
核心类简介 目录 1.1 Authentication 1.2 SecurityContextHolder 1.3 AuthenticationManager和Authenti ...
- Java入门到精通——框架篇之Spring源码分析Spring两大核心类
一.Spring核心类概述. Spring里面有两个最核心的类这是Spring实现最重要的部分. 1.DefaultListableBeanFactory 这个类位于Beans项目下的org.spri ...
- 2017.3.31 spring mvc教程(一)核心类与接口
学习的博客:http://elf8848.iteye.com/blog/875830/ 我项目中所用的版本:4.2.0.博客的时间比较早,11年的,学习的是Spring3 MVC.不知道版本上有没有变 ...
- Spring源码分析(1)容器的基本实现——核心类介绍
bean是Spring中最核心的东西,因为Spring就像是个大水桶,而bean就像是容器中的水,水桶脱离了水便也没什么用处了,那么我们先看看bean的定义. public class MyTestB ...
- 【Spring注解驱动开发】AOP核心类解析,这是最全的一篇了!!
写在前面 昨天二狗子让我给他讲@EnableAspectJAutoProxy注解,讲到AnnotationAwareAspectJAutoProxyCreator类的源码时,二狗子消化不了了.这不,今 ...
随机推荐
- 攻防世界 WEB 高手进阶区 PHP2 Writeup
攻防世界 WEB 高手进阶区 PHP2 Writeup 题目介绍 题目考点 url 二次解码 index.phps 文件(第一次使用dirsearch可能扫不到,需要加到工具字典里) php 简单语法 ...
- 第三天 while循环 及其用法
(1)语法格式:while 条件: ..... 语法二:while 条件: break # 跳出当前循环 语法三:while 条件: else # 当while循环正常结束时执行该语句:只有程 ...
- celery kill task
from celery.task.control import revokerevoke(task_id, terminate=True) https://stackoverflow.com/ques ...
- Nginx面试题(总结最全面的面试题!!!)
https://blog.csdn.net/weixin_43122090/article/details/105461971
- [第三章]c++学习笔记1(this指针)
this指针作用,其作用就是指向成员函数所作用的对象 使用例 为了返回c1,使用this指针,来指向作用的对象 使用空指针调用hello,调用hello欲使其作用在p指向的对象上,然而p没指向任何对象 ...
- 微信小程序(三)开发框架
基本构成: 数据绑定: 例: <!--index.hxml--> <view> <text data-name="{{theName}}">&l ...
- [GYCTF2020]Easyphp
知识点 反序列化pop链 反序列化字符逃逸 解题过程 www.zip 备份文件获取源码 审计代码构造pop链 <?php Class UpdateHelper{ public $id; publ ...
- 从零开始学Kotlin第三课
kotlin函数和函数式表达式的简化写法: fun main(args:Array<String>) { var result=add(2,5) println(result) ///简化 ...
- SpringBoot集成邮件发送
一:简述 在日常中的工作中难免会遇到程序集成邮件发送功能.接收功能:此篇文章我将使用SpringBoot集成邮件发送功能和接收功能:若对邮件一些基本协议和发送流程不懂的请务必参考我之前写的博客或者浏览 ...
- Identity Server 4 从入门到落地(一)—— 从IdentityServer4.Admin开始
最近项目中需要使用Identity Server 4,以前对这个技术只是有些了解,没有系统研究过,网上相关的资料不少,大多是从编写一个简单的认证服务开始,离能够落地使用有相当的距离,理论学习如何不结合 ...