Package org.forgerock.am.oauth2
Class AccessTokenRequest.Builder
- java.lang.Object
-
- org.forgerock.am.oauth2.AccessTokenRequest.Builder
-
- Enclosing class:
- AccessTokenRequest
public static final class AccessTokenRequest.Builder extends Object
Access token request builder.- Since:
- 7.0.0
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessTokenRequest
build()
Builds a new access token request instance, ensuring all prerequisites.AccessTokenRequest.Builder
clientId(String clientId)
Sets the client Id.AccessTokenRequest.Builder
clientSecret(String secret)
Sets the client secret.AccessTokenRequest.Builder
grantType(AccessTokenRequest.GrantType grantType)
AccessTokenRequest.Builder
realm(Realm realm)
Sets the realm context in which an access token should be produced.AccessTokenRequest.Builder
request(Request request)
Adds theRequest
that initialised the access token request.AccessTokenRequest.Builder
scope(String scope)
Adds the scope to the requested set of scopes.AccessTokenRequest.Builder
scopes(Set<String> scopes)
Adds the set of requested scopes to the request.AccessTokenRequest.Builder
subject(String subject)
-
-
-
Method Detail
-
realm
public AccessTokenRequest.Builder realm(Realm realm)
Sets the realm context in which an access token should be produced.- Parameters:
realm
- the realm context- Returns:
- the builder instance
-
clientId
public AccessTokenRequest.Builder clientId(String clientId)
Sets the client Id.- Parameters:
clientId
- the client Id- Returns:
- the builder instance
-
clientSecret
public AccessTokenRequest.Builder clientSecret(String secret)
Sets the client secret.- Parameters:
secret
- the client secret- Returns:
- the builder instance
-
scopes
public AccessTokenRequest.Builder scopes(Set<String> scopes)
Adds the set of requested scopes to the request.- Parameters:
scopes
- a non-null set of scopes- Returns:
- the builder instance
- Throws:
NullPointerException
- if scopes is null
-
scope
public AccessTokenRequest.Builder scope(String scope)
Adds the scope to the requested set of scopes.- Parameters:
scope
- a non-null scope to be added- Returns:
- the builder instance
- Throws:
NullPointerException
- if the scope is nullIllegalArgumentException
- if the scope is blank
-
subject
public AccessTokenRequest.Builder subject(String subject)
-
grantType
public AccessTokenRequest.Builder grantType(AccessTokenRequest.GrantType grantType)
-
request
public AccessTokenRequest.Builder request(Request request)
Adds theRequest
that initialised the access token request.- Parameters:
request
- the originalRequest
for an access token.- Returns:
- the builder instance.
-
build
public AccessTokenRequest build()
Builds a new access token request instance, ensuring all prerequisites.- Returns:
- an access token request
- Throws:
NullPointerException
- if the realm, clientId or secret are nullIllegalArgumentException
- if clientId or secret are blank
-
-