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 GrantType
AUTHORIZATION_CODE
Authorisation code.static GrantType
CLIENT_CREDENTIALS
Client credentials.static GrantType
DEVICE_CODE
Device Code, as defined in OAuth 2.0 Device Flow for Browserless and Input Constrained Devices.static GrantType
IMPLICIT
Implicit.static GrantType
JWT_BEARER
JWT bearer, as defined in RFC 7523.static GrantType
PASSWORD
Password.static GrantType
REFRESH_TOKEN
Refresh token.static GrantType
SAML2_BEARER
SAML 2.0 bearer, as defined in RFC 7522.-
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 boolean
equals(Object object)
Set<String>
getRequestParameterNames()
Gets the names of the token request parameters specific to this grant type.static GrantType
parse(String value)
Parses a grant type from the specified string.boolean
requiresClientAuthentication()
Gets the client authentication requirement.boolean
requiresClientID()
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. Client authentication required only for confidential clients.
-
IMPLICIT
public static final GrantType IMPLICIT
Implicit. Client authentication is not performed (except for signed OpenID Connect authentication requests).
-
REFRESH_TOKEN
public static final GrantType REFRESH_TOKEN
Refresh token. Client authentication required only for confidential clients.
-
PASSWORD
public static final GrantType PASSWORD
Password. Client authentication required only for confidential clients.
-
CLIENT_CREDENTIALS
public static final GrantType CLIENT_CREDENTIALS
Client credentials. Client authentication is required.
-
JWT_BEARER
public static final GrantType JWT_BEARER
JWT bearer, as defined in RFC 7523. Explicit client authentication is optional.
-
SAML2_BEARER
public static final GrantType SAML2_BEARER
SAML 2.0 bearer, as defined in RFC 7522. Explicit client authentication is optional.
-
DEVICE_CODE
public static final GrantType DEVICE_CODE
Device Code, as defined in OAuth 2.0 Device Flow for Browserless and Input Constrained Devices. Explicit client authentication is optional.
-
-
Constructor Detail
-
GrantType
public GrantType(String value)
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 benull
or empty string.
-
-
Method Detail
-
requiresClientAuthentication
public boolean requiresClientAuthentication()
Gets the client authentication requirement.- Returns:
true
if explicit client authentication is always required for this grant type, elsefalse
.
-
requiresClientID
public boolean requiresClientID()
Gets the client identifier requirement.- Returns:
true
if 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
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:
equals
in 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.
-
-