Class IamToken

    • Constructor Detail

      • IamToken

        public IamToken()
      • IamToken

        public IamToken​(java.lang.Throwable t)
      • IamToken

        public IamToken​(VpcTokenResponse vpcResponse)
        Converts a VpcTokenResponse instance to an IamToken instance.
        Parameters:
        vpcResponse - the VpcTokenResponse instance to be converted.
    • Method Detail

      • getRefreshToken

        public java.lang.String getRefreshToken()
      • getTokenType

        public java.lang.String getTokenType()
      • getExpiresIn

        public java.lang.Long getExpiresIn()
      • getExpiration

        public java.lang.Long getExpiration()
      • getRefreshTime

        public java.lang.Long getRefreshTime()
      • needsRefresh

        public boolean needsRefresh()
        Returns true iff currently stored access token should be refreshed. This method uses a buffer to prevent the edge case of the token expiring before the request could be made, so this method will return true if the current time is within that buffer. The buffer will be a fraction of the total TTL. Using 80%. This method also updates the expiration time if it determines the token needs refreshed to prevent other threads from making multiple refresh calls.
        Specified by:
        needsRefresh in class AbstractToken
        Returns:
        true if token is invalid or past the refresh time, false otherwise
      • isTokenValid

        public boolean isTokenValid()
        Check if the currently stored access token is valid. This is different from the needsRefresh method in that it uses the actual TTL to calculate the expiration, rather than just a fraction.
        Specified by:
        isTokenValid in class AbstractToken
        Returns:
        true iff the current access token is valid and not expired
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface ObjectModel
        Overrides:
        toString in class java.lang.Object