类 CustomizeUserDetailsServiceImpl

java.lang.Object
io.github.mangocrisp.spring.taybct.auth.security.service.CustomizeUserDetailsServiceImpl
所有已实现的接口:
ICustomizeUserDetailsService, org.springframework.security.core.userdetails.UserDetailsService

public class CustomizeUserDetailsServiceImpl extends Object implements ICustomizeUserDetailsService, org.springframework.security.core.userdetails.UserDetailsService
自定义登录逻辑
从以下版本开始:
1.0.0
  • 字段详细资料

  • 构造器详细资料

    • CustomizeUserDetailsServiceImpl

      public CustomizeUserDetailsServiceImpl()
  • 方法详细资料

    • loadUserByUsername

      public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username)
      从数据库根据用户名获取到用户信息
      指定者:
      loadUserByUsername 在接口中 ICustomizeUserDetailsService
      指定者:
      loadUserByUsername 在接口中 org.springframework.security.core.userdetails.UserDetailsService
      参数:
      username - 用户名
      返回:
      UserDetails
      从以下版本开始:
      1.0.0
    • loadUserByOpenId

      public org.springframework.security.core.userdetails.UserDetails loadUserByOpenId(String openId) throws org.springframework.security.core.userdetails.UsernameNotFoundException
      从接口复制的说明: ICustomizeUserDetailsService
      微信登录,根据 open id 获取用户信息
      指定者:
      loadUserByOpenId 在接口中 ICustomizeUserDetailsService
      参数:
      openId - open id
      返回:
      UserDetails
      抛出:
      org.springframework.security.core.userdetails.UsernameNotFoundException - 用户名找不到
    • loadUserByPhone

      public org.springframework.security.core.userdetails.UserDetails loadUserByPhone(String phone) throws org.springframework.security.core.userdetails.UsernameNotFoundException
      从接口复制的说明: ICustomizeUserDetailsService
      根据手机号获取用户信息
      指定者:
      loadUserByPhone 在接口中 ICustomizeUserDetailsService
      参数:
      phone - 手机号码
      返回:
      UserDetails
      抛出:
      org.springframework.security.core.userdetails.UsernameNotFoundException - 用户名找不到
    • setPassword

      private void setPassword(OAuth2UserDTO user)
      设置登录用户的密码
      这里需要把从数据库拿出来的 RSA 加密的密码解密然后再去与前端的密码做比较
      最后对称加密一下用于 OAuth2 做鉴权比对
      参数:
      user - 从数据库,或者是哪里获取到的用户信息