java.lang.Object
io.micronaut.security.oauth2.endpoint.token.response.TokenResponse
Direct Known Subclasses:
OpenIdTokenResponse

@Introspected public class TokenResponse extends Object
Represent the response of an authorization server to a valid access token request.
Since:
1.2.0
Author:
Sergio del Amo
See Also:
  • Constructor Details

    • TokenResponse

      public TokenResponse()
      Instantiates Access Token Response.
    • TokenResponse

      public TokenResponse(@NonNull @NonNull String accessToken, @NonNull @NonNull String tokenType)
      Instantiates Access Token Response.
      Parameters:
      accessToken - Access token issued by the authorization server.
      tokenType - The type of the token issued.
  • Method Details

    • getAccessToken

      @NonNull public @NonNull String getAccessToken()
      Returns:
      The access token issued by the authorization server.
    • setAccessToken

      public void setAccessToken(@NonNull @NonNull String accessToken)
      Parameters:
      accessToken - The access token issued by the authorization server.
    • getTokenType

      @NonNull public @NonNull String getTokenType()
      Returns:
      The type of the token issued.
    • setTokenType

      public void setTokenType(@NonNull @NonNull String tokenType)
      Parameters:
      tokenType - The type of the token issued.
    • getExpiresIn

      @Nullable public @Nullable Integer getExpiresIn()
      Returns:
      The lifetime in seconds of the access token.
    • setExpiresIn

      public void setExpiresIn(@Nullable @Nullable Integer expiresIn)
      Parameters:
      expiresIn - The lifetime in seconds of the access token.
    • getExpiresInDate

      @NonNull public @NonNull Optional<Date> getExpiresInDate()
      Returns:
      Expiration date of the access token. Calculated with the expiresIn received by the authorization server.
    • getScope

      @Nullable public @Nullable String getScope()
      Returns:
      Scope of the access token.
    • setScope

      public void setScope(@Nullable @Nullable String scope)
      Parameters:
      scope - Scope of the access token.
    • getRefreshToken

      @Nullable public @Nullable String getRefreshToken()
      Returns:
      The refresh token, which can be used to obtain new access tokens using the same authorization grant.
    • setRefreshToken

      public void setRefreshToken(@Nullable @Nullable String refreshToken)
      Parameters:
      refreshToken - The refresh token, which can be used to obtain new access tokens using the same authorization grant.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object