zhanghua
2025-06-11 2ca169c85f61256fb5185c078dba1bfef2be5066
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
package cn.lili.modules.connect.config;
 
 
import cn.lili.modules.connect.entity.enums.AuthResponseStatus;
import cn.lili.modules.connect.exception.AuthException;
 
/**
 * OAuth平台的API地址的统一接口
 *
 * @author Chopper
 * @version v4.0
 * @since 2020/12/4 12:17
 */
public interface ConnectAuth {
 
    /**
     * 授权的api
     *
     * @return url
     */
    String authorize();
 
    /**
     * 获取accessToken的api
     *
     * @return url
     */
    String accessToken();
 
    /**
     * 获取用户信息的api
     *
     * @return url
     */
    String userInfo();
 
    /**
     * 取消授权的api
     *
     * @return url
     */
    default String revoke() {
        throw new AuthException(AuthResponseStatus.UNSUPPORTED);
    }
 
    /**
     * 刷新授权的api
     *
     * @return url
     */
    default String refresh() {
        throw new AuthException(AuthResponseStatus.UNSUPPORTED);
    }
 
    /**
     * 获取Source的字符串名字
     *
     * @return name
     */
    default String getName() {
        if (this instanceof Enum) {
            return String.valueOf(this);
        }
        return this.getClass().getSimpleName();
    }
}