Class TokenResponse

java.lang.Object
co.ankatech.keymanagement.client.auth.model.TokenResponse

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", comments="Generator version: 7.23.0") public class TokenResponse extends Object
OAuth 2.0 token response (RFC 6749 §5.1) for every grant. The token-exchange grant answers with the same format plus issued_token_type and scope (RFC 8693 §2.2.1), and without refresh_token and passwordChangeEligible
  • Field Details

  • Constructor Details

    • TokenResponse

      public TokenResponse()
  • Method Details

    • getTokenTypeAsString

      public String getTokenTypeAsString()
      The wire value of token_type: what the server sent, verbatim.
      • For a value this release declares, the same wire value the enum names.
      • For a value it does not declare (one a later server added), the server's wire value verbatim, while getTokenType() reads UNKNOWN_DEFAULT_OPEN_API; writing this model sends that wire value back, never the sentinel.
      • For an absent member, null.
      Returns:
      the wire value, or null when the member is absent
    • accessToken

      public TokenResponse accessToken(@Nonnull String accessToken)
    • getAccessToken

      @Nonnull public String getAccessToken()
      JWT access token used for authenticating API requests
      Returns:
      accessToken
    • setAccessToken

      public void setAccessToken(@Nonnull String accessToken)
    • refreshToken

      public TokenResponse refreshToken(@Nullable String refreshToken)
    • getRefreshToken

      @Nullable public String getRefreshToken()
      Sent as null on the grants that issue a person's session (authorization_code and refresh_token), which deliver the refresh token in an HttpOnly cookie, and on the client_credentials grant, which issues none (RFC 6749 §4.4.3). Absent on the token-exchange grant (RFC 8693 §2.2.1).
      Returns:
      refreshToken
    • setRefreshToken

      public void setRefreshToken(@Nullable String refreshToken)
    • tokenType

      public TokenResponse tokenType(@Nonnull TokenResponse.TokenTypeEnum tokenType)
    • getTokenType

      @Nonnull public TokenResponse.TokenTypeEnum getTokenType()
      Token type (RFC 6749 §7.1): 'Bearer' on every grant, except 'DPoP' (RFC 9449 §5) for an administrative workload's client_credentials grant sent with a DPoP proof, whose token is bound to the proof key
      Returns:
      tokenType
    • setTokenType

      public void setTokenType(@Nonnull TokenResponse.TokenTypeEnum tokenType)
    • expiresIn

      public TokenResponse expiresIn(@Nonnull Integer expiresIn)
    • getExpiresIn

      @Nonnull public Integer getExpiresIn()
      Access token lifetime in seconds (typically 36000 = 10 hours)
      Returns:
      expiresIn
    • setExpiresIn

      public void setExpiresIn(@Nonnull Integer expiresIn)
    • passwordChangeEligible

      public TokenResponse passwordChangeEligible(@Nullable Boolean passwordChangeEligible)
    • getPasswordChangeEligible

      @Nullable public Boolean getPasswordChangeEligible()
      Whether the account this token names holds a password managed by ANKASecure and may therefore change it through POST /api/v3/auth/account/password/change. False for an account whose credential is held by an external identity provider, and false on every grant that does not resolve the fact (refresh_token, client_credentials). Present on the password, tenant-selection, client_credentials and refresh_token grants; absent on the token-exchange grant. It is a rendering hint for the console, never an authorization decision: the change endpoint refuses the same subject regardless of what this says.
      Returns:
      passwordChangeEligible
    • setPasswordChangeEligible

      public void setPasswordChangeEligible(@Nullable Boolean passwordChangeEligible)
    • issuedTokenType

      public TokenResponse issuedTokenType(@Nullable String issuedTokenType)
    • getIssuedTokenType

      @Nullable public String getIssuedTokenType()
      URI identifying the type of the issued token (RFC 8693 §2.2.1). Present on the token-exchange grant only.
      Returns:
      issuedTokenType
    • setIssuedTokenType

      public void setIssuedTokenType(@Nullable String issuedTokenType)
    • scope

      public TokenResponse scope(@Nullable String scope)
    • getScope

      @Nullable public String getScope()
      Space-delimited list of the granted scopes (RFC 6749 §5.1, RFC 8693 §2.2.1). Present on the token-exchange grant only.
      Returns:
      scope
    • setScope

      public void setScope(@Nullable String scope)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • validateJsonElement

      public static void validateJsonElement(com.google.gson.JsonElement jsonElement) throws IOException
      Validates the JSON Element and throws an exception if issues found
      Parameters:
      jsonElement - JSON Element
      Throws:
      IOException - if the JSON Element is invalid with respect to TokenResponse
    • validateJsonElementAsCandidate

      public static void validateJsonElementAsCandidate(com.google.gson.JsonElement jsonElement) throws IOException
      Validates the JSON Element as a candidate of a oneOf schema: the checks of validateJsonElement(JsonElement), and the element carries no member this model does not declare. A oneOf schema without a discriminator tells its candidates apart by their member sets, so a candidate is matched on its closed member set.
      Parameters:
      jsonElement - JSON Element
      Throws:
      IOException - if the JSON Element is not a TokenResponse
    • fromJson

      public static TokenResponse fromJson(String jsonString) throws IOException
      Create an instance of TokenResponse given an JSON string
      Parameters:
      jsonString - JSON string
      Returns:
      An instance of TokenResponse
      Throws:
      IOException - if the JSON string is invalid with respect to TokenResponse
    • toJson

      public String toJson()
      Convert an instance of TokenResponse to an JSON string
      Returns:
      JSON string