Class OAuth2Token.Builder
java.lang.Object
cloud.opencode.base.oauth2.OAuth2Token.Builder
- Enclosing class:
OAuth2Token
OAuth2Token Builder
OAuth2Token 构建器
- Since:
- JDK 25, opencode-base-oauth2 V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccessToken(String accessToken) Set the access token 设置访问令牌build()Build the OAuth2Token 构建 OAuth2TokenSet the expiration time 设置过期时间expiresIn(long seconds) Set expires in seconds from now 设置从现在起的过期秒数Set the ID token (OIDC) 设置 ID 令牌(OIDC)Set the issued at time 设置签发时间refreshToken(String refreshToken) Set the refresh token 设置刷新令牌Add a scope 添加权限范围Set the scopes 设置权限范围scopeString(String scopeString) Set scopes from space-separated string 从空格分隔的字符串设置权限范围Set the token type 设置令牌类型
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
accessToken
Set the access token 设置访问令牌- Parameters:
accessToken- the access token | 访问令牌- Returns:
- this builder | 此构建器
-
tokenType
Set the token type 设置令牌类型- Parameters:
tokenType- the token type (default: Bearer) | 令牌类型(默认:Bearer)- Returns:
- this builder | 此构建器
-
refreshToken
Set the refresh token 设置刷新令牌- Parameters:
refreshToken- the refresh token | 刷新令牌- Returns:
- this builder | 此构建器
-
idToken
Set the ID token (OIDC) 设置 ID 令牌(OIDC)- Parameters:
idToken- the ID token | ID 令牌- Returns:
- this builder | 此构建器
-
scopes
Set the scopes 设置权限范围- Parameters:
scopes- the scopes | 权限范围- Returns:
- this builder | 此构建器
-
scope
Add a scope 添加权限范围- Parameters:
scope- the scope | 权限范围- Returns:
- this builder | 此构建器
-
scopeString
Set scopes from space-separated string 从空格分隔的字符串设置权限范围- Parameters:
scopeString- space-separated scopes | 空格分隔的权限范围- Returns:
- this builder | 此构建器
-
expiresIn
Set expires in seconds from now 设置从现在起的过期秒数- Parameters:
seconds- seconds until expiration | 到期秒数- Returns:
- this builder | 此构建器
-
expiresAt
Set the expiration time 设置过期时间- Parameters:
expiresAt- the expiration time | 过期时间- Returns:
- this builder | 此构建器
-
issuedAt
Set the issued at time 设置签发时间- Parameters:
issuedAt- the issued at time | 签发时间- Returns:
- this builder | 此构建器
-
build
Build the OAuth2Token 构建 OAuth2Token- Returns:
- the token | 令牌
- Throws:
NullPointerException- if accessToken is null | 如果 accessToken 为 null
-