Package com.nimbusds.oauth2.sdk
Class GrantType
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.id.Identifier
-
- com.nimbusds.oauth2.sdk.GrantType
-
- All Implemented Interfaces:
Serializable,Comparable<Identifier>,net.minidev.json.JSONAware
@Immutable public final class GrantType extends Identifier
Authorisation grant type.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static GrantTypeAUTHORIZATION_CODEAuthorisation code, as specified in RFC 6749.static GrantTypeCIBAClient Initiated Back-channel Authentication (CIBA), as specified in OpenID Connect Client Initiated Backchannel Authentication Flow - Core 1.0.static GrantTypeCLIENT_CREDENTIALSClient credentials, as specified in RFC 6749.static GrantTypeDEVICE_CODEDevice authorisation grant, as specified in RFC 8628.static GrantTypeIMPLICITImplicit, as specified in RFC 6749.static GrantTypeJWT_BEARERJWT bearer, as specified in RFC 7523.static GrantTypePASSWORDPassword, as specified in RFC 6749.static GrantTypeREFRESH_TOKENRefresh token, as specified in RFC 6749.static GrantTypeSAML2_BEARERSAML 2.0 bearer, as specified in RFC 7522.static GrantTypeTOKEN_EXCHANGEToken exchange, as specified in RFC 8693.-
Fields inherited from class com.nimbusds.oauth2.sdk.id.Identifier
DEFAULT_BYTE_LENGTH, secureRandom
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidensure(GrantType grantType, Map<String,List<String>> params)Ensures the specified grant type is set in a list of parameters.booleanequals(Object object)Set<String>getRequestParameterNames()Gets the names of the token request parameters specific to this grant type.ParameterRequirementgetScopeRequirementInTokenRequest()Gets the scope parameter requirement in token requests.static GrantTypeparse(String value)Parses a grant type from the specified string.booleanrequiresClientAuthentication()Gets the client authentication requirement.booleanrequiresClientID()Gets the client identifier requirement.-
Methods inherited from class com.nimbusds.oauth2.sdk.id.Identifier
compareTo, getValue, hashCode, toJSONString, toString, toStringList
-
-
-
-
Field Detail
-
AUTHORIZATION_CODE
public static final GrantType AUTHORIZATION_CODE
Authorisation code, as specified in RFC 6749.
-
REFRESH_TOKEN
public static final GrantType REFRESH_TOKEN
Refresh token, as specified in RFC 6749.
-
CLIENT_CREDENTIALS
public static final GrantType CLIENT_CREDENTIALS
Client credentials, as specified in RFC 6749.
-
JWT_BEARER
public static final GrantType JWT_BEARER
JWT bearer, as specified in RFC 7523.
-
SAML2_BEARER
public static final GrantType SAML2_BEARER
SAML 2.0 bearer, as specified in RFC 7522.
-
DEVICE_CODE
public static final GrantType DEVICE_CODE
Device authorisation grant, as specified in RFC 8628.
-
CIBA
public static final GrantType CIBA
Client Initiated Back-channel Authentication (CIBA), as specified in OpenID Connect Client Initiated Backchannel Authentication Flow - Core 1.0.
-
TOKEN_EXCHANGE
public static final GrantType TOKEN_EXCHANGE
Token exchange, as specified in RFC 8693.
-
-
Constructor Detail
-
GrantType
public GrantType(String value)
Creates a new OAuth 2.0 authorisation grant type with the specified value. The client authentication and identifier requirements are set tofalse. The scope parameter in token requests is not allowed.- Parameters:
value- The authorisation grant type value. Must not benullor empty string.
-
-
Method Detail
-
requiresClientAuthentication
public boolean requiresClientAuthentication()
Gets the client authentication requirement.- Returns:
trueif explicit client authentication is always required for this grant type, elsefalse.
-
requiresClientID
public boolean requiresClientID()
Gets the client identifier requirement.- Returns:
trueif a client identifier must always be communicated for this grant type (either as part of the client authentication, or as a parameter in the token request), elsefalse.
-
getScopeRequirementInTokenRequest
public ParameterRequirement getScopeRequirementInTokenRequest()
Gets the scope parameter requirement in token requests.- Returns:
- The scope parameter requirement.
-
getRequestParameterNames
public Set<String> getRequestParameterNames()
Gets the names of the token request parameters specific to this grant type.- Returns:
- The parameter names, empty set if none.
-
equals
public boolean equals(Object object)
- Overrides:
equalsin classIdentifier
-
parse
public static GrantType parse(String value) throws ParseException
Parses a grant type from the specified string.- Parameters:
value- The string to parse.- Returns:
- The grant type.
- Throws:
ParseException- If string isnull, blank or empty.
-
ensure
public static void ensure(GrantType grantType, Map<String,List<String>> params) throws ParseException
Ensures the specified grant type is set in a list of parameters.- Parameters:
grantType- The grant type. Must not benull.params- The parameters. Must not benull.- Throws:
ParseException- If the grant type is not set.
-
-