Interface OAuthToken

  • All Superinterfaces:
    org.refcodes.mixin.Disposable, org.refcodes.mixin.Disposable.Disposedable, org.refcodes.mixin.DisposedAccessor, org.refcodes.mixin.ValidAccessor
    All Known Implementing Classes:
    OAuthTokenImpl

    public interface OAuthToken
    extends org.refcodes.mixin.ValidAccessor, org.refcodes.mixin.Disposable.Disposedable
    An OAuth-Token contains all relevant information to access a protected resource and refresh the the access token. "If the request for an access token is valid, the authorization server needs to generate an access token (and optional refresh token) and return these to the client, typically along with some additional properties about the authorization." HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-store Pragma: no-cache { "access_token":"MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", "token_type":"bearer", "expires_in":3600, "refresh_token":"IwOGYzYTlmM2YxOTQ5MGE3YmNmMDFkNTVk", "scope":"create" } See "https://www.oauth.com/oauth2-servers/access-tokens/access-token-response"
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.mixin.Disposable

        org.refcodes.mixin.Disposable.Disposedable
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.DisposedAccessor

        org.refcodes.mixin.DisposedAccessor.DisposedMutator, org.refcodes.mixin.DisposedAccessor.DisposedProperty
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.ValidAccessor

        org.refcodes.mixin.ValidAccessor.ValidBuilder<B extends org.refcodes.mixin.ValidAccessor.ValidBuilder<B>>, org.refcodes.mixin.ValidAccessor.ValidMutator, org.refcodes.mixin.ValidAccessor.ValidProperty
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getAccessToken()
      Returns the access token.
      java.lang.Integer getExpiresIn()
      Returns the time in seconds till the access token (getAccessToken()) expires.
      java.lang.String getRefreshToken()
      Returns the refresh token.
      java.lang.String getScope()
      Returns the OAuth scope.
      java.lang.String getTokenType()
      Returns the token type.
      boolean isValid()
      Returns always true if no "expires in" time (getExpiresIn()) has been set!
      • Methods inherited from interface org.refcodes.mixin.Disposable

        dispose
      • Methods inherited from interface org.refcodes.mixin.DisposedAccessor

        isDisposed
    • Method Detail

      • getAccessToken

        java.lang.String getAccessToken()
        Returns the access token. "The access token string as issued by the authorization server." See "https://www.oauth.com/oauth2-servers/access-tokens/access-token-response"
        Returns:
        the access token.
      • getRefreshToken

        java.lang.String getRefreshToken()
        Returns the refresh token. "The access token string as issued by the authorization server." See "https://www.oauth.com/oauth2-servers/access-tokens/access-token-response"
        Returns:
        the refresh token.
      • getScope

        java.lang.String getScope()
        Returns the OAuth scope. "If the scope the user granted is identical to the scope the app requested, this parameter is optional. If the granted scope is different from the requested scope, such as if the user modified the scope, then this parameter is required." See "https://www.oauth.com/oauth2-servers/access-tokens/access-token-response"
        Returns:
        the OAuth scope.
      • getTokenType

        java.lang.String getTokenType()
        Returns the token type. "The type of token this is, typically just the string bearer" See "https://www.oauth.com/oauth2-servers/access-tokens/access-token-response"
        Returns:
        the token type.
      • getExpiresIn

        java.lang.Integer getExpiresIn()
        Returns the time in seconds till the access token (getAccessToken()) expires. "If the access token expires, the server should reply with the duration of time the access token is granted for." See "https://www.oauth.com/oauth2-servers/access-tokens/access-token-response"
        Returns:
        the Expires-In time in seconds
      • isValid

        boolean isValid()
        Returns always true if no "expires in" time (getExpiresIn()) has been set!
        Specified by:
        isValid in interface org.refcodes.mixin.ValidAccessor