public interface ConnectionService
AuthUser.
Allows for implicitly creating a local user profile from connection data during a provider sign-in attempt.
note: To replace the implementation logic of the built-in auth_token and user_connection tables,
implement this interface to inject the IOC container,
And set the property ums.repository.enableStartUpInitializeTable = false.| 限定符和类型 | 方法和说明 |
|---|---|
void |
binding(org.springframework.security.core.userdetails.UserDetails principal,
me.zhyd.oauth.model.AuthUser authUser,
String providerId)
第三方授权登录信息
AuthUser绑定到本地账号UserDetails, 且添加第三方授权登录信息到 user_connection 与 auth_token |
List<ConnectionData> |
findConnectionByProviderIdAndProviderUserId(String providerId,
String providerUserId)
根据 providerId 与 providerUserId 获取 ConnectionData list.
|
org.springframework.util.MultiValueMap<String,ConnectionDto> |
listAllConnections(String userId)
Find all connections the current user has across all providers.
|
org.springframework.security.core.userdetails.UserDetails |
signUp(me.zhyd.oauth.model.AuthUser authUser,
String providerId,
String encodeState)
Sign up a new user of the application from the connection.
|
void |
unbinding(String userId,
String providerId,
String providerUserId)
解除绑定(第三方)
|
void |
updateUserConnectionAndAuthToken(me.zhyd.oauth.model.AuthUser authUser,
ConnectionData connectionData)
根据传入的参数更新第三方授权登录的用户信息, 包括 accessToken 信息,
|
@NonNull
org.springframework.security.core.userdetails.UserDetails signUp(@NonNull
me.zhyd.oauth.model.AuthUser authUser,
@NonNull
String providerId,
@NonNull
String encodeState)
throws top.dcenter.ums.security.core.exception.RegisterUserFailureException
authUser.getUsername() 重名, 则使用 authUser.getUsername() + "_" + authUser.getSource() 或
authUser.getUsername() + "_" + authUser.getSource() + "_" + authUser.getUuid() 即
username_{providerId}_{providerUserId}.authUser - the user info from the provider sign-in attemptproviderId - 第三方服务商, 如: qq, githubencodeState - 加密后的 state. https://gitee.com/pcore/just-auth-spring-security-starter/issues/I22JC7top.dcenter.ums.security.core.exception.RegisterUserFailureException - 用户重名或注册失败void updateUserConnectionAndAuthToken(me.zhyd.oauth.model.AuthUser authUser,
ConnectionData connectionData)
throws UpdateConnectionException
authUser - AuthUserconnectionData - 第三方授权登录的用户信息UpdateConnectionException - 更新异常void binding(@NonNull
org.springframework.security.core.userdetails.UserDetails principal,
@NonNull
me.zhyd.oauth.model.AuthUser authUser,
@NonNull
String providerId)
AuthUser绑定到本地账号UserDetails, 且添加第三方授权登录信息到 user_connection 与 auth_tokenprincipal - 本地用户数据authUser - 第三方用户信息providerId - 第三方服务商 Idvoid unbinding(@NonNull
String userId,
@NonNull
String providerId,
@NonNull
String providerUserId)
userId - 用户 IdproviderId - 第三方服务商 IdproviderUserId - 第三方用户 Id@Nullable List<ConnectionData> findConnectionByProviderIdAndProviderUserId(@NonNull String providerId, @NonNull String providerUserId)
providerId - 第三方服务商, 如: qq, githubproviderUserId - 第三方用户 Id@NonNull org.springframework.util.MultiValueMap<String,ConnectionDto> listAllConnections(@NonNull String userId)
ConnectionDatas that exist between the user and that provider.
For example, if the user is connected once to Facebook and twice to Twitter, the returned map would contain two entries with the following structure:
{
"qq" -> Connection("Jack") ,
"github" -> Connection("Tomas"), Connection("Jessica")
}
The returned map is sorted by providerId and entry values are ordered by rank.
Returns an empty map if the user has no connections.userId - the userIdCopyright © 2021. All rights reserved.