Package org.forgerock.am.oauth2
Class AccessTokenResponse.Builder
- java.lang.Object
-
- org.forgerock.am.oauth2.AccessTokenResponse.Builder
-
- Enclosing class:
- AccessTokenResponse
public static final class AccessTokenResponse.Builder extends Object
Access token response builder.- Since:
- 7.0.0
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessTokenResponse.Builder
accessToken(String accessToken)
Sets the access token.AccessTokenResponse
build()
Builds a new access token response instance, ensuring all prerequisites.AccessTokenResponse.Builder
expiresIn(Duration expiresIn)
Sets the expires in duration.AccessTokenResponse.Builder
scopes(Set<String> scopes)
Sets the scopes associated with access token.AccessTokenResponse.Builder
tokenType(String tokenType)
Sets the token type.
-
-
-
Method Detail
-
accessToken
public AccessTokenResponse.Builder accessToken(String accessToken)
Sets the access token.- Parameters:
accessToken
- the access token- Returns:
- the builder instance
-
tokenType
public AccessTokenResponse.Builder tokenType(String tokenType)
Sets the token type.- Parameters:
tokenType
- the token type- Returns:
- the builder instance
-
expiresIn
public AccessTokenResponse.Builder expiresIn(Duration expiresIn)
Sets the expires in duration.- Parameters:
expiresIn
- the expires in duration- Returns:
- the builder instance
-
scopes
public AccessTokenResponse.Builder scopes(Set<String> scopes)
Sets the scopes associated with access token.- Parameters:
scopes
- the scopes associated with access token- Returns:
- the builder instance
-
build
public AccessTokenResponse build()
Builds a new access token response instance, ensuring all prerequisites.- Returns:
- an access token response
- Throws:
NullPointerException
- if accessToken, tokenType or expiration are nullIllegalArgumentException
- if accessToken or tokenType are blank
-
-