Class GrantAuthorization

java.lang.Object
com.nimbusds.openid.connect.provider.spi.grants.GrantAuthorization
Direct Known Subclasses:
SubjectAuthorization

@Immutable public class GrantAuthorization extends Object
Basic OAuth 2.0 authorisation produced by a GrantHandler.

Required authorisation details:

  • The authorised scope.

All other parameters are optional or have suitable defaults.

  • Constructor Details

    • GrantAuthorization

      public GrantAuthorization(com.nimbusds.oauth2.sdk.Scope scope)
      Creates a new basic authorisation.
      Parameters:
      scope - The authorised scope values. Must not be null.
    • GrantAuthorization

      public GrantAuthorization(com.nimbusds.oauth2.sdk.Scope scope, AccessTokenSpec accessTokenSpec, @Nullable net.minidev.json.JSONObject data)
      Creates a new basic authorisation.
      Parameters:
      scope - The authorised scope. Must not be null.
      accessTokenSpec - The access token specification. Must not be null.
      data - Additional data as a JSON object, null if not specified.
    • GrantAuthorization

      public GrantAuthorization(com.nimbusds.oauth2.sdk.Scope scope, AccessTokenSpec accessTokenSpec, ClaimsSpec claimsSpec, @Nullable net.minidev.json.JSONObject data)
      Creates a new basic authorisation.
      Parameters:
      scope - The authorised scope. Must not be null.
      accessTokenSpec - The access token specification. Must not be null.
      claimsSpec - The OpenID claims specification. Must not be null.
      data - Additional data as a JSON object, null if not specified.
    • GrantAuthorization

      @Deprecated public GrantAuthorization(com.nimbusds.oauth2.sdk.Scope scope, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, AccessTokenSpec accessTokenSpec, @Nullable net.minidev.json.JSONObject data)
      Deprecated.
      Creates a new basic authorisation.
      Parameters:
      scope - The authorised scope. Must not be null.
      audList - Explicit audience of the access token, null if not specified.
      accessTokenSpec - The access token specification. Must not be null.
      data - Additional data as a JSON object, null if not specified.
  • Method Details

    • getScope

      public com.nimbusds.oauth2.sdk.Scope getScope()
      Returns the authorised scope.
      Returns:
      The authorised scope.
    • getAudience

      @Deprecated public @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> getAudience()
      Deprecated.
      Returns the explicit audience of the access token.
      Returns:
      The audience of the access token, null if not specified.
    • getAccessTokenSpec

      Returns the access token specification.
      Returns:
      The access token specification.
    • getClaimsSpec

      Returns the OpenID claims specification.
      Returns:
      The OpenID claims specification.
    • getData

      public @Nullable net.minidev.json.JSONObject getData()
      Returns the additional data as a JSON object.
      Returns:
      The additional data, null if not specified.
    • toJSONObject

      public net.minidev.json.JSONObject toJSONObject()
      Returns a JSON object representation of this authorisation.
      Returns:
      The JSON object representation.
    • parse

      public static GrantAuthorization parse(net.minidev.json.JSONObject jsonObject) throws com.nimbusds.oauth2.sdk.ParseException
      Parses a basic authorisation from the specified JSON object.
      Parameters:
      jsonObject - The JSON object to parse. Must not be null.
      Returns:
      The basic authorisation.
      Throws:
      com.nimbusds.oauth2.sdk.ParseException - If parsing failed.
    • parse

      public static GrantAuthorization parse(String json) throws com.nimbusds.oauth2.sdk.ParseException
      Parses a basic authorisation from the specified JSON object string.
      Parameters:
      json - The JSON object string to parse. Must not be null.
      Returns:
      The basic authorisation.
      Throws:
      com.nimbusds.oauth2.sdk.ParseException - If parsing failed.