接口 ICustomizeUserDetailsService
- 所有已知实现类:
CustomizeUserDetailsServiceImpl
public interface ICustomizeUserDetailsService
定义自己的用户查询接口,继承的 oauth2 的查询接口已经有按用户名查询了
这里再定义几个,例如,使用 open id ,或者 手机号码,或者用户 id 等方式
- 从以下版本开始:
- 1.0.0
-
方法概要
修饰符和类型方法说明default org.springframework.security.core.userdetails.UserDetails
loadUserByOpenId
(String openId) 微信登录,根据 open id 获取用户信息default org.springframework.security.core.userdetails.UserDetails
loadUserByPhone
(String phone) 根据手机号获取用户信息default org.springframework.security.core.userdetails.UserDetails
loadUserByUserId
(String userId) 根据用户 id 获取用户信息org.springframework.security.core.userdetails.UserDetails
loadUserByUsername
(String username) Locates the user based on the username.void
setEncoder
(Function<String, String> encoder) 设置加密器
-
方法详细资料
-
loadUserByUsername
org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException Locates the user based on the username. In the actual implementation, the search may possibly be case sensitive, or case insensitive depending on how the implementation instance is configured. In this case, theUserDetails
object that comes back may have a username that is of a different case than what was actually requested..- 参数:
username
- the username identifying the user whose data is required.- 返回:
- a fully populated user record (never
null
) - 抛出:
org.springframework.security.core.userdetails.UsernameNotFoundException
- if the user could not be found or the user has no GrantedAuthority
-
loadUserByOpenId
default org.springframework.security.core.userdetails.UserDetails loadUserByOpenId(String openId) throws org.springframework.security.core.userdetails.UsernameNotFoundException 微信登录,根据 open id 获取用户信息- 参数:
openId
- open id- 返回:
UserDetails
- 抛出:
org.springframework.security.core.userdetails.UsernameNotFoundException
- 用户名找不到
-
loadUserByPhone
default org.springframework.security.core.userdetails.UserDetails loadUserByPhone(String phone) throws org.springframework.security.core.userdetails.UsernameNotFoundException 根据手机号获取用户信息- 参数:
phone
- 手机号码- 返回:
UserDetails
- 抛出:
org.springframework.security.core.userdetails.UsernameNotFoundException
- 用户名找不到
-
loadUserByUserId
default org.springframework.security.core.userdetails.UserDetails loadUserByUserId(String userId) throws org.springframework.security.core.userdetails.UsernameNotFoundException 根据用户 id 获取用户信息- 参数:
userId
- 手机号码- 返回:
UserDetails
- 抛出:
org.springframework.security.core.userdetails.UsernameNotFoundException
- 用户找不到
-
setEncoder
设置加密器- 参数:
encoder
- 加密处理
-