{"id":15567069,"url":"https://github.com/justauth/justauth-spring-boot-starter","last_synced_at":"2025-04-08T11:09:44.208Z","repository":{"id":35443609,"uuid":"198165166","full_name":"justauth/justauth-spring-boot-starter","owner":"justauth","description":"Spring Boot 集成 JustAuth 的最佳实践~","archived":false,"fork":false,"pushed_at":"2025-01-13T08:17:20.000Z","size":96,"stargazers_count":353,"open_issues_count":10,"forks_count":94,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T09:34:01.163Z","etag":null,"topics":["justauth","spring-boot-starter","springboot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justauth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-22T06:54:45.000Z","updated_at":"2025-03-31T16:01:21.000Z","dependencies_parsed_at":"2024-06-18T15:19:50.472Z","dependency_job_id":"5d7ff1a1-2aa0-4d29-ae61-fc2cebed525b","html_url":"https://github.com/justauth/justauth-spring-boot-starter","commit_stats":{"total_commits":90,"total_committers":3,"mean_commits":30.0,"dds":"0.12222222222222223","last_synced_commit":"42339022190f03259402e9daa25b8fa2c808b7d4"},"previous_names":["xkcoding/justauth-spring-boot-starter"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justauth%2Fjustauth-spring-boot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justauth%2Fjustauth-spring-boot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justauth%2Fjustauth-spring-boot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justauth%2Fjustauth-spring-boot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justauth","download_url":"https://codeload.github.com/justauth/justauth-spring-boot-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441917,"owners_count":20939382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["justauth","spring-boot-starter","springboot"],"created_at":"2024-10-02T17:09:51.572Z","updated_at":"2025-04-08T11:09:44.176Z","avatar_url":"https://github.com/justauth.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# justauth-spring-boot-starter\n\n\u003e Spring Boot 集成 JustAuth 的最佳实践~\n\u003e\n\u003e JustAuth 脚手架\n\n![Maven Central](https://img.shields.io/maven-central/v/com.xkcoding.justauth/justauth-spring-boot-starter.svg?color=brightgreen\u0026label=Maven%20Central)![Travis (.com)](https://img.shields.io/travis/com/xkcoding/justauth-spring-boot-starter.svg?label=Build%20Status)![GitHub](https://img.shields.io/github/license/xkcoding/justauth-spring-boot-starter.svg)\n\n## 1. Demo\n\n懒得看文档的，可以直接看demo\n\nhttps://github.com/xkcoding/justauth-spring-boot-starter-demo\n\n完整版 demo：https://github.com/xkcoding/spring-boot-demo/tree/master/spring-boot-demo-social\n\n## 2. 更新日志\n\n[CHANGELOG](./CHANGELOG.md)\n\n## 3. 快速开始\n\n### 3.1. 基础配置\n\n- 引用依赖\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.xkcoding.justauth\u003c/groupId\u003e\n  \u003cartifactId\u003ejustauth-spring-boot-starter\u003c/artifactId\u003e\n  \u003cversion\u003e1.4.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n- 添加配置，在 `application.yml` 中添加配置配置信息\n\n注意：\n\n- `justauth.type`节点的配置，请根据项目实际情况选择，多余的可以删除\n- 如果使用 QQ 登录，并且需要获取`unionId`，则必须传`union-id`配置，并置为`true`\n- 如果使用支付宝登录，必传`alipay-public-key`\n- 如果使用 Stack Overflow 登录，必传`stack-overflow-key`\n- 如果使用企业微信登录，必传`agent-id`\n- 如果使用 CODING 登录，必传`coding-group-name`\n\n```yaml\njustauth:\n  enabled: true\n  type:\n    QQ:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/qq/callback\n      union-id: false\n    WEIBO:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/weibo/callback\n    GITEE:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/gitee/callback\n    DINGTALK:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/dingtalk/callback\n    BAIDU:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/baidu/callback\n    CSDN:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/csdn/callback\n    CODING:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/coding/callback\n      coding-group-name: xx\n    OSCHINA:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/oschina/callback\n    ALIPAY:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/alipay/callback\n      alipay-public-key: MIIB**************DAQAB\n    WECHAT_OPEN:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_open/callback\n    WECHAT_MP:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_mp/callback\n    WECHAT_ENTERPRISE:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_enterprise/callback\n      agent-id: 1000002\n    TAOBAO:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/taobao/callback\n    GOOGLE:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/google/callback\n    FACEBOOK:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/facebook/callback\n    DOUYIN:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/douyin/callback\n    LINKEDIN:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/linkedin/callback\n    MICROSOFT:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/microsoft/callback\n    MI:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/mi/callback\n    TOUTIAO:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/toutiao/callback\n    TEAMBITION:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/teambition/callback\n    RENREN:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/renren/callback\n    PINTEREST:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/pinterest/callback\n    STACK_OVERFLOW:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/stack_overflow/callback\n      stack-overflow-key: asd*********asd\n    HUAWEI:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/huawei/callback\n    KUJIALE:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/kujiale/callback\n    GITLAB:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/gitlab/callback\n    MEITUAN:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/meituan/callback\n    ELEME:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/eleme/callback\n    TWITTER:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/twitter/callback\n    XMLY:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/xmly/callback\n      # 设备唯一标识ID\n      device-id: xxxxxxxxxxxxxx\n      # 客户端操作系统类型，1-iOS系统，2-Android系统，3-Web\n      client-os-type: 3\n      # 客户端包名，如果 clientOsType 为1或2时必填。对Android客户端是包名，对IOS客户端是Bundle ID\n      #pack-id: xxxx\n    FEISHU:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/feishu/callback\n    JD:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/jd/callback\n  cache:\n    type: default\n```\n\n\n\n- 然后就开始玩耍吧~\n\n```java\n@Slf4j\n@RestController\n@RequestMapping(\"/oauth\")\n@RequiredArgsConstructor(onConstructor_ = @Autowired)\npublic class TestController {\n    private final AuthRequestFactory factory;\n\n    @GetMapping\n    public List\u003cString\u003e list() {\n        return factory.oauthList();\n    }\n\n    @GetMapping(\"/login/{type}\")\n    public void login(@PathVariable String type, HttpServletResponse response) throws IOException {\n        AuthRequest authRequest = factory.get(type);\n        response.sendRedirect(authRequest.authorize(AuthStateUtils.createState()));\n    }\n\n    @RequestMapping(\"/{type}/callback\")\n    public AuthResponse login(@PathVariable String type, AuthCallback callback) {\n        AuthRequest authRequest = factory.get(type);\n        AuthResponse response = authRequest.login(callback);\n        log.info(\"【response】= {}\", JSONUtil.toJsonStr(response));\n        return response;\n    }\n\n}\n```\n\n### 3.2. 缓存配置\n\n\u003e starter 内置了2种缓存实现，一种是上面的默认实现，另一种是基于 Redis 的缓存实现。\n\u003e\n\u003e 当然了，你也可以自定义实现你自己的缓存。\n\n#### 3.2.1. 默认缓存实现\n\n在配置文件配置如下内容即可\n\n```yaml\njustauth:\n  cache:\n    type: default\n```\n\n#### 3.2.2. Redis 缓存实现\n\n1.添加 Redis 相关依赖\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.springframework.boot\u003c/groupId\u003e\n  \u003cartifactId\u003espring-boot-starter-data-redis\u003c/artifactId\u003e\n\u003c/dependency\u003e\n\n\u003c!-- 对象池，使用redis时必须引入 --\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.apache.commons\u003c/groupId\u003e\n  \u003cartifactId\u003ecommons-pool2\u003c/artifactId\u003e\n\u003c/dependency\u003e\n```\n\n2.配置文件配置如下内容即可\n\n```yaml\njustauth:\n  cache:\n    type: redis\n    # 缓存前缀，目前只对redis缓存生效，默认 JUSTAUTH::STATE::\n    prefix: ''\n    # 超时时长，目前只对redis缓存生效，默认3分钟\n    timeout: 1h\nspring:\n  redis:\n    host: localhost\n    # 连接超时时间（记得添加单位，Duration）\n    timeout: 10000ms\n    # Redis默认情况下有16个分片，这里配置具体使用的分片\n    # database: 0\n    lettuce:\n      pool:\n        # 连接池最大连接数（使用负值表示没有限制） 默认 8\n        max-active: 8\n        # 连接池最大阻塞等待时间（使用负值表示没有限制） 默认 -1\n        max-wait: -1ms\n        # 连接池中的最大空闲连接 默认 8\n        max-idle: 8\n        # 连接池中的最小空闲连接 默认 0\n        min-idle: 0\n```\n\n#### 3.2.3. 自定义缓存实现\n\n1.配置文件配置如下内容\n\n```yaml\njustauth:\n  cache:\n    type: custom\n```\n\n2.自定义缓存实现 `AuthStateCache` 接口\n\n```java\n/**\n * \u003cp\u003e\n * 自定义缓存实现\n * \u003c/p\u003e\n *\n * @author yangkai.shen\n * @date Created in 2019/8/31 12:53\n */\npublic class MyAuthStateCache implements AuthStateCache {\n    /**\n     * 存入缓存\n     *\n     * @param key   缓存key\n     * @param value 缓存内容\n     */\n    @Override\n    public void cache(String key, String value) {\n        // TODO: 自定义存入缓存\n    }\n\n    /**\n     * 存入缓存\n     *\n     * @param key     缓存key\n     * @param value   缓存内容\n     * @param timeout 指定缓存过期时间（毫秒）\n     */\n    @Override\n    public void cache(String key, String value, long timeout) {\n        // TODO: 自定义存入缓存\n    }\n\n    /**\n     * 获取缓存内容\n     *\n     * @param key 缓存key\n     * @return 缓存内容\n     */\n    @Override\n    public String get(String key) {\n        // TODO: 自定义获取缓存内容\n        return null;\n    }\n\n    /**\n     * 是否存在key，如果对应key的value值已过期，也返回false\n     *\n     * @param key 缓存key\n     * @return true：存在key，并且value没过期；false：key不存在或者已过期\n     */\n    @Override\n    public boolean containsKey(String key) {\n        // TODO: 自定义判断key是否存在\n        return false;\n    }\n}\n```\n\n3.自动装配 `JustAuthConfig`\n\n```java\n/**\n * \u003cp\u003e\n * 自定义缓存装配\n * \u003c/p\u003e\n *\n * @author yangkai.shen\n * @date Created in 2019/8/31 12:29\n */\n@Configuration\npublic class AuthStateConfiguration {\n    @Bean\n    public AuthStateCache authStateCache() {\n        return new MyAuthStateCache();\n    }\n}\n```\n\n### 3.3. 自定义第三方平台配置\n\n1.创建自定义的平台枚举类\n\n```java\n/**\n * \u003cp\u003e\n * 扩展的自定义 source\n * \u003c/p\u003e\n *\n * @author yangkai.shen\n * @date Created in 2019/10/9 14:14\n */\npublic enum ExtendSource implements AuthSource {\n\n    /**\n     * 测试\n     */\n    TEST {\n        /**\n         * 授权的api\n         *\n         * @return url\n         */\n        @Override\n        public String authorize() {\n            return \"http://authorize\";\n        }\n\n        /**\n         * 获取accessToken的api\n         *\n         * @return url\n         */\n        @Override\n        public String accessToken() {\n            return \"http://accessToken\";\n        }\n\n        /**\n         * 获取用户信息的api\n         *\n         * @return url\n         */\n        @Override\n        public String userInfo() {\n            return null;\n        }\n\n        /**\n         * 取消授权的api\n         *\n         * @return url\n         */\n        @Override\n        public String revoke() {\n            return null;\n        }\n\n        /**\n         * 刷新授权的api\n         *\n         * @return url\n         */\n        @Override\n        public String refresh() {\n            return null;\n        }\n    }\n}\n```\n\n2.创建自定义的请求处理\n\n```java\n/**\n * \u003cp\u003e\n * 测试用自定义扩展的第三方request\n * \u003c/p\u003e\n *\n * @author yangkai.shen\n * @date Created in 2019/10/9 14:19\n */\npublic class ExtendTestRequest extends AuthDefaultRequest {\n\n    public ExtendTestRequest(AuthConfig config) {\n        super(config, ExtendSource.TEST);\n    }\n\n    public ExtendTestRequest(AuthConfig config, AuthStateCache authStateCache) {\n        super(config, ExtendSource.TEST, authStateCache);\n    }\n\n    /**\n     * 获取access token\n     *\n     * @param authCallback 授权成功后的回调参数\n     * @return token\n     * @see AuthDefaultRequest#authorize()\n     * @see AuthDefaultRequest#authorize(String)\n     */\n    @Override\n    protected AuthToken getAccessToken(AuthCallback authCallback) {\n        return AuthToken.builder().openId(\"openId\").expireIn(1000).idToken(\"idToken\").scope(\"scope\").refreshToken(\"refreshToken\").accessToken(\"accessToken\").code(\"code\").build();\n    }\n\n    /**\n     * 使用token换取用户信息\n     *\n     * @param authToken token信息\n     * @return 用户信息\n     * @see AuthDefaultRequest#getAccessToken(AuthCallback)\n     */\n    @Override\n    protected AuthUser getUserInfo(AuthToken authToken) {\n        return AuthUser.builder().username(\"test\").nickname(\"test\").gender(AuthUserGender.MALE).token(authToken).source(this.source.toString()).build();\n    }\n\n    /**\n     * 撤销授权\n     *\n     * @param authToken 登录成功后返回的Token信息\n     * @return AuthResponse\n     */\n    @Override\n    public AuthResponse revoke(AuthToken authToken) {\n        return AuthResponse.builder().code(AuthResponseStatus.SUCCESS.getCode()).msg(AuthResponseStatus.SUCCESS.getMsg()).build();\n    }\n\n    /**\n     * 刷新access token （续期）\n     *\n     * @param authToken 登录成功后返回的Token信息\n     * @return AuthResponse\n     */\n    @Override\n    public AuthResponse refresh(AuthToken authToken) {\n        return AuthResponse.builder().code(AuthResponseStatus.SUCCESS.getCode()).data(AuthToken.builder().openId(\"openId\").expireIn(1000).idToken(\"idToken\").scope(\"scope\").refreshToken(\"refreshToken\").accessToken(\"accessToken\").code(\"code\").build()).build();\n    }\n}\n```\n\n3.在配置文件配置相关信息\n\n```yaml\njustauth:\n  enabled: true\n  extend:\n    enum-class: com.xkcoding.justauthspringbootstarterdemo.extend.ExtendSource\n    config:\n      TEST:\n        request-class: com.xkcoding.justauthspringbootstarterdemo.extend.ExtendTestRequest\n        client-id: xxxxxx\n        client-secret: xxxxxxxx\n        redirect-uri: http://oauth.xkcoding.com/demo/oauth/test/callback\n```\n\n## 4. http 代理配置\n\n修改配置文件，增加如下配置：\n\n```yaml\njustauth:\n  http-config:\n    timeout: 30000\n    proxy:\n      GOOGLE:\n        type: HTTP\n        hostname: 127.0.0.1\n        port: 10080\n```\n\n注：当项目中使用了自定义的第三方登录，并且需要使用代理时，也要在 `http-config` 节点下添加相关配置，格式参考上面示例\n\n## 5. 自定义 Scopes\n\n修改配置文件，增加如下配置：\n\n```yml\njustauth:\n  enabled: true\n  type:\n    QQ:\n      client-id: 10**********6\n      client-secret: 1f7d08**********5b7**********29e\n      redirect-uri: http://oauth.xkcoding.com/demo/oauth/qq/callback\n      union-id: false\n      scopes:\n       - get_user_info\n       - xxxx\n```\n\n注：你可以前往 `me.zhyd.oauth.enums.scope` 包下查看各个渠道所支持的 scopes，当然你可以不配置该项，JustAuth 会默认添加上一些基础 scope\n\n## 6. 附录\n\n### 6.1. `justauth` 配置列表\n\n| 属性名             | 类型                                                         | 默认值 | 可选项     | 描述                   |\n| ------------------ | ------------------------------------------------------------ | ------ | ---------- | ---------------------- |\n| `justauth.enabled` | `boolean`                                                    | true   | true/false | 是否启用 JustAuth      |\n| `justauth.type`    | `java.util.Map\u003cme.zhyd.oauth.config.AuthSource,me.zhyd.oauth.config.AuthConfig\u003e` | 无     |            | JustAuth 配置          |\n| `justauth.httpConfig`    | `java.util.Map\u003cme.zhyd.oauth.config.AuthSource,com.xkcoding.justauth.autoconfigure.JustAuthProperties.JustAuthHttpConfig\u003e` | 无     |            | http 相关配置          |\n| `justauth.cache`   | `com.xkcoding.justauth.autoconfigure.CacheProperties`        |        |            | JustAuth缓存配置       |\n| `justauth.extend`  | `com.xkcoding.justauth.autoconfigure.ExtendProperties`       | 无     |            | JustAuth第三方平台配置 |\n\n#### `justauth.type` 配置列表\n\n| 属性名                      | 描述                                                         |\n| --------------------------- | ------------------------------------------------------------ |\n| `justauth.type.keys`        | `justauth.type` 是 `Map` 格式的，key 的取值请参考 [`AuthDefaultSource`](https://github.com/zhangyd-c/JustAuth/blob/master/src/main/java/me/zhyd/oauth/config/AuthDefaultSource.java) |\n| `justauth.type.keys.values` | `justauth.type` 是 `Map` 格式的，value 的取值请参考 [`AuthConfig`](https://github.com/zhangyd-c/JustAuth/blob/master/src/main/java/me/zhyd/oauth/config/AuthConfig.java) |\n\n##### `justauth.type.keys.values` 所有可选配置如下：\n\n| 属性名                      | 描述                                                         | 备注                             |\n| --------------------------- | -----------------------------------------------------------  | ------------------------------- |\n| `client-id`        |  客户端id，对应各平台的appKey  | **必填** |\n| `client-secret` |  客户端Secret，对应各平台的appSecret  | **必填** |\n| `redirect-uri` |  登录成功后的回调地址  | **必填** |\n| `alipay-public-key` |  支付宝公钥  | 当使用支付宝登录时， **该值必填**，对应“RSA2(SHA256)密钥”中的“支付宝公钥” |\n| `union-id` |  是否需要申请unionid  | 当使用QQ登录时，该值**选填**，如果置为`true`则qq开发者应用必须具备相应权限，参考链接：[查看详情](http://wiki.connect.qq.com/unionid%E4%BB%8B%E7%BB%8D) |\n| `stack-overflow-key` |  Stack Overflow Key  | 当使用Stack Overflow登录时， **该值必填** |\n| `agent-id` |  企业微信，授权方的网页应用ID  | 当使用企业微信登录时， **该值必填** |\n| `coding-group-name` |  团队域名前缀 | 使用 Coding 登录时， **该值必填** |\n\n#### `justauth.httpConfig` 配置列表\n\n| 属性名                      | 描述                                                         |\n| --------------------------- | ------------------------------------------------------------ |\n| `justauth.httpConfig.keys`        | `justauth.type` 是 `Map` 格式的，key 的取值请参考 [`AuthDefaultSource`](https://github.com/zhangyd-c/JustAuth/blob/master/src/main/java/me/zhyd/oauth/config/AuthDefaultSource.java) |\n| `justauth.httpConfig.keys.values` | `justauth.type` 是 `Map` 格式的，value 的取值请参考 `JustAuthProperties.JustAuthHttpConfig` |\n\n##### `justauth.httpConfig.keys.values` 所有可选配置如下：\n\n| 属性名                      | 描述                                                         | 备注                             |\n| --------------------------- | -----------------------------------------------------------  | ------------------------------- |\n| `timeout`        |  请求超时时间  |  |\n| `proxy` |  代理的相关配置，针对国外平台，需要配置代理  | **必填** |\n\n##### `justauth.httpConfig.proxy` 所有可选配置如下：\n\n| 属性名                      | 描述                                                         | 备注                             |\n| --------------------------- | -----------------------------------------------------------  | ------------------------------- |\n| `type`        |  代理类型，可选值：`HTTP`、`DIRECT`、`SOCKS`，默认为 `HTTP`  |  |\n| `hostname` |  代理 IP 地址  |  |\n| `port` |  代理端口  |  |\n\n#### `justauth.cache` 配置列表\n\n| 属性名                   | 类型                                                         | 默认值            | 可选项               | 描述                                                         |\n| ------------------------ | ------------------------------------------------------------ | ----------------- | -------------------- | ------------------------------------------------------------ |\n| `justauth.cache.type`    | `com.xkcoding.justauth.autoconfigure.CacheProperties.CacheType` | default           | default/redis/custom | 缓存类型，default使用JustAuth默认的缓存实现，redis使用默认的redis缓存实现，custom用户自定义缓存实现 |\n| `justauth.cache.prefix`  | `java.lang.String`                                           | JUSTAUTH::STATE:: |                      | 缓存前缀，目前只对redis缓存生效，默认 `JUSTAUTH::STATE::`    |\n| `justauth.cache.timeout` | `java.time.Duration`                                         | 3分钟             |                      | 超时时长，目前只对redis缓存生效，默认`3分钟`                 |\n\n#### `justauth.extend` 配置列表\n\n| 属性名                       | 类型                                         | 默认值 | 可选项 | 描述         |\n| ---------------------------- | -------------------------------------------- | ------ | ------ | ------------ |\n| `justauth.extend.enum-class` | `Class\u003c? extends AuthSource\u003e`                | 无     |        | 枚举类全路径 |\n| `justauth.extend.config`     | `java.util.Map\u003cString, ExtendRequestConfig\u003e` | 无     |        | 对应配置信息 |\n\n##### `justauth.extend.config` 配置列表\n\n| 属性名                          | 类型                                                         | 默认值 | 可选项 | 描述                                                         |\n| ------------------------------- | ------------------------------------------------------------ | ------ | ------ | ------------------------------------------------------------ |\n| `justauth.extend.config.keys`   | `java.lang.String`                                           | 无     |        | key 必须在 `justauth.extend.enum-class` 配置的枚举类中声明   |\n| `justauth.extend.config.values` | `com.xkcoding.justauth.autoconfigure.ExtendProperties.ExtendRequestConfig` | 无     |        | value 就是 `AuthConfig` 的子类，增加了一个 `request-class` 属性配置请求的全类名，具体参考类[`ExtendProperties.ExtendRequestConfig`](https://github.com/justauth/justauth-spring-boot-starter/blob/master/src/main/java/com/xkcoding/justauth/autoconfigure/ExtendProperties.java#L49-L54) |\n\n### 6.2. SNAPSHOT版本\n\n![https://img.shields.io/badge/snapshots-1.4.0--SNAPSHOT-green](https://img.shields.io/badge/snapshots-1.4.0--SNAPSHOT-green)如果需要体验快照版本，可以在你的 `pom.xml`进行如下配置：\n\n```xml\n\u003crepositories\u003e\n    \u003c!--阿里云私服--\u003e\n    \u003crepository\u003e\n      \u003cid\u003ealiyun\u003c/id\u003e\n      \u003cname\u003ealiyun\u003c/name\u003e\n      \u003curl\u003ehttp://maven.aliyun.com/nexus/content/groups/public\u003c/url\u003e\n    \u003c/repository\u003e\n    \u003c!--中央仓库--\u003e\n    \u003crepository\u003e\n      \u003cid\u003eoss\u003c/id\u003e\n      \u003cname\u003eoss\u003c/name\u003e\n      \u003curl\u003ehttp://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n      \u003creleases\u003e\n        \u003cenabled\u003etrue\u003c/enabled\u003e\n      \u003c/releases\u003e\n      \u003csnapshots\u003e\n        \u003cenabled\u003etrue\u003c/enabled\u003e\n      \u003c/snapshots\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustauth%2Fjustauth-spring-boot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustauth%2Fjustauth-spring-boot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustauth%2Fjustauth-spring-boot-starter/lists"}