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:
  • Field Details

    • AUTHORIZATION_CODE

      public static final GrantType AUTHORIZATION_CODE
      Authorisation code, as specified in RFC 6749.
    • IMPLICIT

      public static final GrantType IMPLICIT
      Implicit, as specified in RFC 6749.
    • REFRESH_TOKEN

      public static final GrantType REFRESH_TOKEN
      Refresh token, as specified in RFC 6749.
    • PASSWORD

      public static final GrantType PASSWORD
      Password, 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 Details

    • 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 to false. The scope parameter in token requests is not allowed.
      Parameters:
      value - The authorisation grant type value. Must not be null or empty string.
  • Method Details

    • getShortName

      public String getShortName()
      Returns a short (display) name for the grant.
      Returns:
      The short name.
    • requiresClientAuthentication

      public boolean requiresClientAuthentication()
      Gets the client authentication requirement.
      Returns:
      true if explicit client authentication is always required for this grant type, else false.
    • 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), else false.
    • getScopeRequirementInTokenRequest

      Gets the scope parameter requirement in token requests.
      Returns:
      The scope parameter requirement.
    • 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 class Identifier
    • 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 is null, 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 be null.
      params - The parameters. Must not be null.
      Throws:
      ParseException - If the grant type is not set.