Package org.forgerock.am.oauth2
Class AccessTokenRequest.Builder
java.lang.Object
org.forgerock.am.oauth2.AccessTokenRequest.Builder
- Enclosing class:
- AccessTokenRequest
Access token request builder.
- Since:
- 7.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a new access token request instance, ensuring all prerequisites.Sets the client Id.clientSecret
(String secret) Sets the client secret.grantType
(AccessTokenRequest.GrantType grantType) Sets the realm context in which an access token should be produced.Adds theRequest
that initialised the access token request.Adds the scope to the requested set of scopes.Adds the set of requested scopes to the request.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
realm
Sets the realm context in which an access token should be produced.- Parameters:
realm
- the realm context- Returns:
- the builder instance
-
clientId
Sets the client Id.- Parameters:
clientId
- the client Id- Returns:
- the builder instance
-
clientSecret
Sets the client secret.- Parameters:
secret
- the client secret- Returns:
- the builder instance
-
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
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
-
grantType
-
request
Adds theRequest
that initialised the access token request.- Parameters:
request
- the originalRequest
for an access token.- Returns:
- the builder instance.
-
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
-