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
Authorisation grant type.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GrantTypeAuthorisation code.static final GrantTypeClient Initiated Back-channel Authentication (CIBA), as defined in OpenID Connect Client Initiated Backchannel Authentication Flow - Core 1.0.static final GrantTypeClient credentials.static final GrantTypeDevice Code, as defined in OAuth 2.0 Device Flow for Browserless and Input Constrained Devices.static final GrantTypeImplicit.static final GrantTypeJWT bearer, as defined in RFC 7523.static final GrantTypePassword.static final GrantTypeRefresh token.static final GrantTypeSAML 2.0 bearer, as defined in RFC 7522.static final GrantTypeToken Exchange, as defined in RFC 8693.Fields inherited from class com.nimbusds.oauth2.sdk.id.Identifier
DEFAULT_BYTE_LENGTH, secureRandom -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidEnsures the specified grant type is set in a list of parameters.booleanGets the names of the token request parameters specific to this grant type.static GrantTypeParses a grant type from the specified string.booleanGets the client authentication requirement.booleanGets the client identifier requirement.Methods inherited from class com.nimbusds.oauth2.sdk.id.Identifier
compareTo, getValue, hashCode, toJSONString, toString, toStringList
-
Field Details
-
AUTHORIZATION_CODE
Authorisation code. Client authentication required only for confidential clients. -
IMPLICIT
Implicit. Client authentication is not performed (except for signed OpenID Connect authentication requests). -
REFRESH_TOKEN
Refresh token. Client authentication required only for confidential clients. -
PASSWORD
Password. Client authentication required only for confidential clients. -
CLIENT_CREDENTIALS
Client credentials. Client authentication is required. -
JWT_BEARER
JWT bearer, as defined in RFC 7523. Explicit client authentication is optional. -
SAML2_BEARER
SAML 2.0 bearer, as defined in RFC 7522. Explicit client authentication is optional. -
DEVICE_CODE
Device Code, as defined in OAuth 2.0 Device Flow for Browserless and Input Constrained Devices. Explicit client authentication is optional. -
CIBA
Client Initiated Back-channel Authentication (CIBA), as defined in OpenID Connect Client Initiated Backchannel Authentication Flow - Core 1.0. Explicit client authentication is optional. -
TOKEN_EXCHANGE
Token Exchange, as defined in RFC 8693. Explicit client authentication is optional.
-
-
Constructor Details
-
GrantType
Creates a new OAuth 2.0 authorisation grant type with the specified value. The client authentication requirement is set tofalse. So is the client identifier requirement.- Parameters:
value- The authorisation grant type value. Must not benullor empty string.
-
-
Method Details
-
requiresClientAuthentication
Gets the client authentication requirement.- Returns:
trueif explicit client authentication is always required for this grant type, elsefalse.
-
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 body), elsefalse.
-
getRequestParameterNames
Gets the names of the token request parameters specific to this grant type.- Returns:
- The parameter names, empty set if none.
-
equals
- Overrides:
equalsin classIdentifier
-
parse
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 ParseExceptionEnsures 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.
-