Package org.forgerock.secrets.oauth2
Class GrantTypeHandler
- java.lang.Object
-
- org.forgerock.secrets.oauth2.GrantTypeHandler
-
- Direct Known Subclasses:
AuthorizationCodeGrantTypeHandler,ClientCredentialsGrantTypeHandler,JwtBearerGrantTypeHandler,RefreshTokenGrantTypeHandler,ResourceOwnerPasswordGrantTypeHandler
public abstract class GrantTypeHandler extends Object
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
Constructors Modifier Constructor Description protectedGrantTypeHandler(String grantType, String clientId)Initialises the grant type handler with the given grant type name and client id.protectedGrantTypeHandler(String grantType, String clientId, Collection<String> scope)Initialises the grant type handler with the given grant type name and client id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetClientId()The client id of the client using this grant type.StringgetGrantType()The name of the grant type implemented by this handler.protected Collection<String>getScope()The requested scopes.protected Promise<Form,NoSuchSecretException>handle(Request tokenEndpointRequest, Form form)Handles the request by adding appropriate parameters to the OAuth 2.0 token endpoint request.StringtoString()
-
-
-
Constructor Detail
-
GrantTypeHandler
protected GrantTypeHandler(String grantType, String clientId, Collection<String> scope)
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.
-
-
Method Detail
-
handle
protected Promise<Form,NoSuchSecretException> handle(Request tokenEndpointRequest, Form form)
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
public String getGrantType()
The name of the grant type implemented by this handler.- Returns:
- the name of the grant type.
-
getClientId
public String getClientId()
The client id of the client using this grant type.- Returns:
- the client id.
-
getScope
protected Collection<String> getScope()
The requested scopes.- Returns:
- the scopes.
-
-