Class OAuthBearerTokenCallback

  • All Implemented Interfaces:
    javax.security.auth.callback.Callback

    @Evolving
    public class OAuthBearerTokenCallback
    extends java.lang.Object
    implements javax.security.auth.callback.Callback
    A Callback for use by the SaslClient and Login implementations when they require an OAuth 2 bearer token. Callback handlers should use the error(String, String, String) method to communicate errors returned by the authorization server as per RFC 6749: The OAuth 2.0 Authorization Framework. Callback handlers should communicate other problems by raising an IOException.

    This class was introduced in 2.0.0 and, while it feels stable, it could evolve. We will try to evolve the API in a compatible manner, but we reserve the right to make breaking changes in minor releases, if necessary. We will update the InterfaceStability annotation and this notice once the API is considered stable.

    • Constructor Detail

      • OAuthBearerTokenCallback

        public OAuthBearerTokenCallback()
    • Method Detail

      • token

        public OAuthBearerToken token()
        Return the (potentially null) token
        Returns:
        the (potentially null) token
      • errorCode

        public java.lang.String errorCode()
        Return the optional (but always non-empty if not null) error code as per RFC 6749: The OAuth 2.0 Authorization Framework.
        Returns:
        the optional (but always non-empty if not null) error code
      • token

        public void token​(OAuthBearerToken token)
        Set the token. All error-related values are cleared.
        Parameters:
        token - the optional token to set
      • error

        public void error​(java.lang.String errorCode,
                          java.lang.String errorDescription,
                          java.lang.String errorUri)
        Set the error values as per RFC 6749: The OAuth 2.0 Authorization Framework. Any token is cleared.
        Parameters:
        errorCode - the mandatory error code to set
        errorDescription - the optional error description to set
        errorUri - the optional error URI to set