Class TokenResult

java.lang.Object
org.glassfish.jersey.client.oauth2.TokenResult

public class TokenResult extends Object
Class that contains a result of the Authorization Flow including a access token.

All result properties can be get by the method getAllProperties(). Some of the properties are standardized by the OAuth 2 specification and therefore the class contains getters that extract these properties from the property map.

Since:
2.3
  • Field Details

  • Constructor Details

    • TokenResult

      public TokenResult(Map<String,Object> properties)
      Create a new instance initiated from the property map.
      Parameters:
      properties - Access properties.
  • Method Details

    • getAccessToken

      public String getAccessToken()
      Get access token.
      Returns:
      Access token.
    • getExpiresIn

      public Long getExpiresIn()
      Get expiration time of the access token in seconds.
      Returns:
      Expiration time in seconds or null if the value is not provided.
    • getRefreshToken

      public String getRefreshToken()
      Get the refresh token. Note that the refresh token must not be issued during the authorization flow. Some Service Providers issue refresh token only on first user authorization and some providers does not support refresh token at all and authorization flow must be always performed when token expires.
      Returns:
      Refresh token or null if the value is not provided.
    • getTokenType

      public String getTokenType()
      Get the type of the returned access token. Type is in most cases bearer (no cryptography is used) but provider might support also other kinds of token like mac.
      Returns:
      Token type.
    • getAllProperties

      public Map<String,Object> getAllProperties()
      Get the map of all properties returned in the Access Token Response.
      Returns:
      Map with all token properties.
    • getProperty

      private String getProperty(String name)