Class OAuth2Config.Builder
java.lang.Object
cloud.opencode.base.oauth2.OAuth2Config.Builder
- Enclosing class:
OAuth2Config
OAuth2Config Builder
OAuth2Config 构建器
- Since:
- JDK 25, opencode-base-oauth2 V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthorizationEndpoint(String authorizationEndpoint) Set the authorization endpoint 设置授权端点build()Build the OAuth2Config 构建 OAuth2ConfigSet the client ID 设置客户端 IDclientSecret(String clientSecret) Set the client secret 设置客户端密钥connectTimeout(Duration connectTimeout) Set the connect timeout 设置连接超时deviceAuthorizationEndpoint(String deviceAuthorizationEndpoint) Set the device authorization endpoint 设置设备授权端点expectedIssuer(String expectedIssuer) Set the expected issuer for validation (RFC 9207) 设置用于验证的预期颁发者(RFC 9207)Set the grant type 设置授权类型introspectionEndpoint(String introspectionEndpoint) Set the token introspection endpoint (RFC 7662) 设置令牌内省端点(RFC 7662)parEndpoint(String parEndpoint) Set the Pushed Authorization Request endpoint (RFC 9126) 设置推送授权请求端点(RFC 9126)readTimeout(Duration readTimeout) Set the read timeout 设置读取超时redirectUri(String redirectUri) Set the redirect URI 设置重定向 URIrefreshThreshold(Duration refreshThreshold) Set the refresh threshold 设置刷新阈值Set the resource indicator (RFC 8707) 设置资源指示器(RFC 8707)revocationEndpoint(String revocationEndpoint) Set the revocation endpoint 设置撤销端点Add a scope 添加权限范围Set the scopes 设置权限范围Set the scopes from a set 从集合设置权限范围tokenEndpoint(String tokenEndpoint) Set the token endpoint 设置令牌端点usePkce(boolean usePkce) Enable or disable PKCE 启用或禁用 PKCEuserInfoEndpoint(String userInfoEndpoint) Set the user info endpoint 设置用户信息端点
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
clientId
Set the client ID 设置客户端 ID- Parameters:
clientId- the client ID | 客户端 ID- Returns:
- this builder | 此构建器
-
clientSecret
Set the client secret 设置客户端密钥- Parameters:
clientSecret- the client secret | 客户端密钥- Returns:
- this builder | 此构建器
-
authorizationEndpoint
Set the authorization endpoint 设置授权端点- Parameters:
authorizationEndpoint- the authorization endpoint | 授权端点- Returns:
- this builder | 此构建器
-
tokenEndpoint
Set the token endpoint 设置令牌端点- Parameters:
tokenEndpoint- the token endpoint | 令牌端点- Returns:
- this builder | 此构建器
-
userInfoEndpoint
Set the user info endpoint 设置用户信息端点- Parameters:
userInfoEndpoint- the user info endpoint | 用户信息端点- Returns:
- this builder | 此构建器
-
revocationEndpoint
Set the revocation endpoint 设置撤销端点- Parameters:
revocationEndpoint- the revocation endpoint | 撤销端点- Returns:
- this builder | 此构建器
-
deviceAuthorizationEndpoint
Set the device authorization endpoint 设置设备授权端点- Parameters:
deviceAuthorizationEndpoint- the device authorization endpoint | 设备授权端点- Returns:
- this builder | 此构建器
-
redirectUri
Set the redirect URI 设置重定向 URI- Parameters:
redirectUri- the redirect URI | 重定向 URI- Returns:
- this builder | 此构建器
-
scopes
Set the scopes 设置权限范围- Parameters:
scopes- the scopes | 权限范围- Returns:
- this builder | 此构建器
-
scopes
Set the scopes from a set 从集合设置权限范围- Parameters:
scopes- the scopes | 权限范围- Returns:
- this builder | 此构建器
-
scope
Add a scope 添加权限范围- Parameters:
scope- the scope | 权限范围- Returns:
- this builder | 此构建器
-
grantType
Set the grant type 设置授权类型- Parameters:
grantType- the grant type | 授权类型- Returns:
- this builder | 此构建器
-
usePkce
Enable or disable PKCE 启用或禁用 PKCE- Parameters:
usePkce- true to enable PKCE | true 启用 PKCE- Returns:
- this builder | 此构建器
-
connectTimeout
Set the connect timeout 设置连接超时- Parameters:
connectTimeout- the connect timeout | 连接超时- Returns:
- this builder | 此构建器
-
readTimeout
Set the read timeout 设置读取超时- Parameters:
readTimeout- the read timeout | 读取超时- Returns:
- this builder | 此构建器
-
refreshThreshold
Set the refresh threshold 设置刷新阈值Token will be refreshed when remaining time is less than this threshold.
当剩余时间小于此阈值时将刷新令牌。
- Parameters:
refreshThreshold- the refresh threshold | 刷新阈值- Returns:
- this builder | 此构建器
-
parEndpoint
Set the Pushed Authorization Request endpoint (RFC 9126) 设置推送授权请求端点(RFC 9126)- Parameters:
parEndpoint- the PAR endpoint | PAR 端点- Returns:
- this builder | 此构建器
-
introspectionEndpoint
Set the token introspection endpoint (RFC 7662) 设置令牌内省端点(RFC 7662)- Parameters:
introspectionEndpoint- the introspection endpoint | 内省端点- Returns:
- this builder | 此构建器
-
resource
Set the resource indicator (RFC 8707) 设置资源指示器(RFC 8707)- Parameters:
resource- the resource indicator | 资源指示器- Returns:
- this builder | 此构建器
-
expectedIssuer
Set the expected issuer for validation (RFC 9207) 设置用于验证的预期颁发者(RFC 9207)- Parameters:
expectedIssuer- the expected issuer | 预期颁发者- Returns:
- this builder | 此构建器
-
build
Build the OAuth2Config 构建 OAuth2Config- Returns:
- the config | 配置
- Throws:
NullPointerException- if clientId is null | 如果 clientId 为 null
-