Class TokenResult


  • public class TokenResult
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.lang.Object> properties  
    • Constructor Summary

      Constructors 
      Constructor Description
      TokenResult​(java.util.Map<java.lang.String,​java.lang.Object> properties)
      Create a new instance initiated from the property map.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAccessToken()
      Get access token.
      java.util.Map<java.lang.String,​java.lang.Object> getAllProperties()
      Get the map of all properties returned in the Access Token Response.
      java.lang.Long getExpiresIn()
      Get expiration time of the access token in seconds.
      private java.lang.String getProperty​(java.lang.String name)  
      java.lang.String getRefreshToken()
      Get the refresh token.
      java.lang.String getTokenType()
      Get the type of the returned access token.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • properties

        private final java.util.Map<java.lang.String,​java.lang.Object> properties
    • Constructor Detail

      • TokenResult

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

      • getAccessToken

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

        public java.lang.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 java.lang.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 java.lang.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 java.util.Map<java.lang.String,​java.lang.Object> getAllProperties()
        Get the map of all properties returned in the Access Token Response.
        Returns:
        Map with all token properties.
      • getProperty

        private java.lang.String getProperty​(java.lang.String name)