Package org.forgerock.secrets.oauth2
Class GrantTypeHandler
java.lang.Object
org.forgerock.secrets.oauth2.GrantTypeHandler
- Direct Known Subclasses:
AuthorizationCodeGrantTypeHandler
,ClientCredentialsGrantTypeHandler
,JwtBearerGrantTypeHandler
,RefreshTokenGrantTypeHandler
,ResourceOwnerPasswordGrantTypeHandler
Abstract base class for OAuth 2 grant type handlers for calling the token endpoint. Each handler can add
additional parameters to the token request.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
GrantTypeHandler
(String grantType, String clientId) Initialises the grant type handler with the given grant type name and client id.protected
GrantTypeHandler
(String grantType, String clientId, Collection<String> scope) Initialises the grant type handler with the given grant type name and client id. -
Method Summary
Modifier and TypeMethodDescriptionThe client id of the client using this grant type.The name of the grant type implemented by this handler.protected Collection<String>
getScope()
The requested scopes.protected Promise<Form,
NoSuchSecretException> Handles the request by adding appropriate parameters to the OAuth 2.0 token endpoint request.toString()
-
Constructor Details
-
GrantTypeHandler
Initialises the grant type handler with the given grant type name and client id.- Parameters:
grantType
- the grant type name such as "client_credentials".clientId
- the client id. May be null.scope
- the scope to add to the request. May not be null. Represents the scope of the authorization grant being requested, as per RFC 6749.
-
GrantTypeHandler
Initialises the grant type handler with the given grant type name and client id.- Parameters:
grantType
- the grant type name such as "client_credentials".clientId
- the client id. May be null.
-
-
Method Details
-
handle
Handles the request by adding appropriate parameters to the OAuth 2.0 token endpoint request.- Parameters:
tokenEndpointRequest
- the original token endpoint request.form
- the POST body to add parameters to.- Returns:
- a promise for the token endpoint request with parameters appropriate for this grant type.
-
getGrantType
The name of the grant type implemented by this handler.- Returns:
- the name of the grant type.
-
getClientId
The client id of the client using this grant type.- Returns:
- the client id.
-
getScope
The requested scopes.- Returns:
- the scopes.
-
toString
-