SpringSecurity实现用户名密码和手机验证码登录验证设计类图-v2022.11
2022-11-17 09:54:21 8 举报
登录查看完整内容
SpringSecurity实现用户名密码和手机验证码登录验证设计类图
作者其他创作
大纲/内容
承载授权信息的一个实体类
MobileUserDetailsServiceImpl
- sysUserDetailsService: SysUserDetailsService- sysUserDao: SysUserDao
+ loadUserByUsername(String username): UserDetails
UsernamePasswordAuthenticationToken
- principal: Object- credentials: Object
1:m
MobileAuthenticationToken
- principal: Object- code: String
<<UserDetailsService>>
+ loadUserByUsername(String username): UserDetails
手机验证码登录(自定义扩展)
<<Authentication>>
+ getAuthorities(): Collection<? extends GrantedAuthority>+ getCredentials(): Object+ getDetails(): Object+ getPrincipal(): Object+ isAuthenticated(): boolean+ setAuthenticated(boolean isAuthenticated): void
UserDetail == Principal
<<PasswordEncoder>>
UserDetail
- id: Long- username: String- password: String- gender: Integer- status: Integer- superAdmin: Integer- ... ...- dataScopeList: List- authoritySet: Set- isAccountNonExpired: boolean- isAccountNonLocked: boolean- isCredentialsNonExpired: boolean- isEnabled: boolean
+ getAuthorities(): Collection<? extends GrantedAuthority>
UserDetail == UPrincipal
DaoAuthenticationProvider
- passwordEncoder: PasswordEncoder- userDetailsService: UserDetailsService- userDetailsPasswordService: UserDetailsPasswordService
两大核心接口
SysUserDetailsService
+ SysMenuService+ SysOrgService+ SysRoleDao+ SysRoleDataScopeDao
+ getUserDetails(SysUserEntity userEntity): UserDetails+ getDataScope(UserDetail userDetail): List
验证手机验证码
UserDetailsServiceImpl
<<AuthenticationManager>>
+ authenticate(Authentication authentication): Authentication
用户名密码登录
MobileVerifyCodeServiceImpl
+ smsApi: SmsApi
<<UserDetails>>
+ getAuthorities(): Collection<? extends GrantedAuthority>+ getPassword(): String+ getUsername(): String+ isAccountNonExpired(): boolean+ isAccountNonLocked(): boolean+ isCredentialsNonExpired(): boolean+ isEnabled(): boolean
MobileAuthenticationProvider
- mobileUserDetailsService: MobileUserDetailsService- mobileVerifyCodeService: MobileVerifyCodeService- authoritiesMapper: GrantedAuthoritiesMapper- messages: MessageSourceAccessor
+ authenticate(Authentication authentication): Authentication+ supports(Class<?> authentication): boolean
<<MobileVerifyCodeService>>
<<MobileUserDetailsService>>
+ loadUserByMobile(String mobile): UserDetails
<<AuthenticationProvider>>
+ authenticate(Authentication authentication): Authentication+ supports(Class<?> authentication): boolean
AbstractAuthenticationToken
- authorities: Collection<GrantedAuthority>- details: Object- authenticated: boolean
+ AbstractAuthenticationToken(Collection<? extends GrantedAuthority> authorities)
ProviderManager
+ providers: List<AuthenticationProvider>+ eventPublisher: AuthenticationEventPublisher
+ ProviderManager(List<AuthenticationProvider> providers):construct- setAuthenticationEventPublisher(AuthenticationEventPublisher eventPublisher):void
AbstractUserDetailsAuthenticationProvider
- authoritiesMapper: GrantedAuthoritiesMapper- userCache: UserCache- messages: MessageSourceAccessor
验证用户名和密码&返回用户权限等信息
0 条评论
回复 删除
下一页