public class AuthConfig extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private String |
agentId
企业微信,授权方的网页应用ID
|
private String |
alipayPublicKey
已过时。
请使用AuthAlipayRequest的构造方法设置"alipayPublicKey"
|
private String |
authServerId
Okta 授权服务器的 ID, 默认为 default。
|
private String |
clientId
客户端id:对应各平台的appKey
|
private Integer |
clientOsType
喜马拉雅:客户端操作系统类型,1-iOS系统,2-Android系统,3-Web
|
private String |
clientSecret
客户端Secret:对应各平台的appSecret
|
private String |
deviceId
设备ID, 设备唯一标识ID
|
private String |
domainPrefix
域名前缀。
|
private HttpConfig |
httpConfig
针对国外服务可以单独设置代理
HttpConfig config = new HttpConfig();
config.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 10080)));
config.setTimeout(15000);
|
private boolean |
ignoreCheckRedirectUri
忽略校验
redirectUri 参数,默认不开启。 |
private boolean |
ignoreCheckState
忽略校验
state 参数,默认不开启。 |
private String |
packId
喜马拉雅:客户端包名,如果
clientOsType 为1或2时必填。 |
private boolean |
pkce
是否开启 PKCE 模式,该配置仅用于支持 PKCE 模式的平台,针对无服务应用,不推荐使用隐式授权,推荐使用 PKCE 模式
|
private String |
redirectUri
登录成功后的回调地址
|
private List<String> |
scopes
支持自定义授权平台的 scope 内容
|
private String |
stackOverflowKey
Stack Overflow Key
|
private boolean |
unionId
是否需要申请unionid,目前只针对qq登录
注:qq授权登录时,获取unionid需要单独发送邮件申请权限。
|
private String |
usertype
企业微信第三方授权用户类型,member|admin
|
| 构造器和说明 |
|---|
AuthConfig() |
private String clientId
private String clientSecret
private String redirectUri
@Deprecated private String alipayPublicKey
private boolean unionId
1.7.1版本新增参数
private String stackOverflowKey
private String agentId
private String usertype
private String domainPrefix
使用 Coding 登录和 Okta 登录时,需要传该值。
Coding 登录:团队域名前缀,比如以“ https://justauth.coding.net ”为例,domainPrefix = justauth
Okta 登录:Okta 账号域名前缀,比如以“ https://justauth.okta.com ”为例,domainPrefix = justauth
private HttpConfig httpConfig
private boolean ignoreCheckState
state 参数,默认不开启。当 ignoreCheckState 为 true 时,
AuthDefaultRequest.login(AuthCallback) 将不会校验 state 的合法性。
使用场景:当且仅当使用自实现 state 校验逻辑时开启
以下场景使用方案仅作参考:
1. 授权、登录为同端,并且全部使用 JustAuth 实现时,该值建议设为 false;
2. 授权和登录为不同端实现时,比如前端页面拼装 authorizeUrl,并且前端自行对state进行校验,
后端只负责使用code获取用户信息时,该值建议设为 true;
如非特殊需要,不建议开启这个配置
该方案主要为了解决以下类似场景的问题:
private String deviceId
private Integer clientOsType
private String packId
clientOsType 为1或2时必填。对Android客户端是包名,对IOS客户端是Bundle IDprivate boolean pkce
private String authServerId
创建自定义授权服务器,请参考:
① https://developer.okta.com/docs/concepts/auth-servers
② https://developer.okta.com/docs/guides/customize-authz-server
private boolean ignoreCheckRedirectUri
redirectUri 参数,默认不开启。当 ignoreCheckRedirectUri 为 true 时,
AuthChecker.checkConfig(AuthConfig, AuthSource) 将不会校验 redirectUri 的合法性。public String getAuthServerId()
Copyright © 2023. All rights reserved.