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 AccessTokenRequestbuild()Builds a new access token request instance, ensuring all prerequisites.AccessTokenRequest.BuilderclientId(String clientId)Sets the client Id.AccessTokenRequest.BuilderclientSecret(String secret)Sets the client secret.AccessTokenRequest.BuildergrantType(AccessTokenRequest.GrantType grantType)AccessTokenRequest.Builderrealm(Realm realm)Sets the realm context in which an access token should be produced.AccessTokenRequest.Builderrequest(Request request)Adds theRequestthat initialised the access token request.AccessTokenRequest.Builderscope(String scope)Adds the scope to the requested set of scopes.AccessTokenRequest.Builderscopes(Set<String> scopes)Adds the set of requested scopes to the request.AccessTokenRequest.Buildersubject(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 theRequestthat initialised the access token request.- Parameters:
request- the originalRequestfor 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
-
-