Record Class AccessTokenResponse

java.lang.Object
java.lang.Record
ca.cdr.test.app.clients.AccessTokenResponse
Record Components:
accessToken - the access_token
tokenType - the token_type, normally Bearer
expiresIn - the expires_in lifetime in seconds, if the server sent one
scope - the granted scope, if the server sent one
idToken - the OpenID Connect id_token, if one was issued
refreshToken - the refresh_token, if one was issued
raw - the whole response, for any member not listed above

public record AccessTokenResponse(@Nonnull String accessToken, @Nullable String tokenType, @Nullable Long expiresIn, @Nullable String scope, @Nullable String idToken, @Nullable String refreshToken, @Nonnull com.fasterxml.jackson.databind.JsonNode raw) extends Record
A successful OAuth 2.0 token endpoint response.
See Also:
  • Constructor Details

    • AccessTokenResponse

      public AccessTokenResponse(@Nonnull String accessToken, @Nullable String tokenType, @Nullable Long expiresIn, @Nullable String scope, @Nullable String idToken, @Nullable String refreshToken, @Nonnull com.fasterxml.jackson.databind.JsonNode raw)
      Creates an instance of a AccessTokenResponse record class.
      Parameters:
      accessToken - the value for the accessToken record component
      tokenType - the value for the tokenType record component
      expiresIn - the value for the expiresIn record component
      scope - the value for the scope record component
      idToken - the value for the idToken record component
      refreshToken - the value for the refreshToken record component
      raw - the value for the raw record component
  • Method Details

    • fromJson

      @Nonnull public static AccessTokenResponse fromJson(@Nonnull com.fasterxml.jackson.databind.JsonNode theResponse)
      Reads a token endpoint response body.
      Parameters:
      theResponse - the parsed response body
      Returns:
      the response
      Throws:
      IllegalArgumentException - if the body carries no access_token
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • accessToken

      @Nonnull public String accessToken()
      Returns the value of the accessToken record component.
      Returns:
      the value of the accessToken record component
    • tokenType

      @Nullable public String tokenType()
      Returns the value of the tokenType record component.
      Returns:
      the value of the tokenType record component
    • expiresIn

      @Nullable public Long expiresIn()
      Returns the value of the expiresIn record component.
      Returns:
      the value of the expiresIn record component
    • scope

      @Nullable public String scope()
      Returns the value of the scope record component.
      Returns:
      the value of the scope record component
    • idToken

      @Nullable public String idToken()
      Returns the value of the idToken record component.
      Returns:
      the value of the idToken record component
    • refreshToken

      @Nullable public String refreshToken()
      Returns the value of the refreshToken record component.
      Returns:
      the value of the refreshToken record component
    • raw

      @Nonnull public com.fasterxml.jackson.databind.JsonNode raw()
      Returns the value of the raw record component.
      Returns:
      the value of the raw record component