yz
2021-02-26 da7fc9b3e00ceed3186662a3662e296f1e581f9c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package cc.mrbird.febs.auth.service;
 
import cc.mrbird.febs.auth.entity.BindUser;
import cc.mrbird.febs.auth.entity.UserConnection;
import cc.mrbird.febs.common.core.entity.FebsResponse;
import cc.mrbird.febs.common.core.exception.FebsException;
import me.zhyd.oauth.model.AuthCallback;
import me.zhyd.oauth.model.AuthUser;
import me.zhyd.oauth.request.AuthRequest;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
 
import java.util.List;
 
/**
 * @author MrBird
 */
public interface SocialLoginService {
 
    /**
     * 解析第三方登录请求
     *
     * @param oauthType 第三方平台类型
     * @return AuthRequest
     * @throws FebsException 异常
     */
    AuthRequest renderAuth(String oauthType) throws FebsException;
 
    /**
     * 处理第三方登录(绑定页面)
     *
     * @param oauthType 第三方平台类型
     * @param callback  回调
     * @return FebsResponse
     * @throws FebsException 异常
     */
    FebsResponse resolveBind(String oauthType, AuthCallback callback) throws FebsException;
 
    /**
     * 处理第三方登录(登录页面)
     *
     * @param oauthType 第三方平台类型
     * @param callback  回调
     * @return FebsResponse
     * @throws FebsException 异常
     */
    FebsResponse resolveLogin(String oauthType, AuthCallback callback) throws FebsException;
 
    /**
     * 绑定并登录
     *
     * @param bindUser 绑定用户
     * @param authUser 第三方平台对象
     * @return OAuth2AccessToken 令牌对象
     * @throws FebsException 异常
     */
    OAuth2AccessToken bindLogin(BindUser bindUser, AuthUser authUser) throws FebsException;
 
    /**
     * 注册并登录
     *
     * @param registUser 注册用户
     * @param authUser   第三方平台对象
     * @return OAuth2AccessToken 令牌对象
     * @throws FebsException 异常
     */
    OAuth2AccessToken signLogin(BindUser registUser, AuthUser authUser) throws FebsException;
 
    /**
     * 绑定
     *
     * @param bindUser 绑定对象
     * @param authUser 第三方平台对象
     * @throws FebsException 异常
     */
    void bind(BindUser bindUser, AuthUser authUser) throws FebsException;
 
    /**
     * 解绑
     *
     * @param bindUser  绑定对象
     * @param oauthType 第三方平台对象
     * @throws FebsException 异常
     */
    void unbind(BindUser bindUser, String oauthType) throws FebsException;
 
    /**
     * 根据用户名获取绑定关系
     *
     * @param username 用户名
     * @return 绑定关系集合
     */
    List<UserConnection> findUserConnections(String username);
}