Class OAuthAccessTokenProvider

java.lang.Object
oracle.nosql.driver.kv.OAuthAccessTokenProvider
All Implemented Interfaces:
AuthorizationProvider

public abstract class OAuthAccessTokenProvider extends Object implements AuthorizationProvider
On-premises only.

An authorization provider that exchanges an application-supplied OAuth access token for a NoSQL login token through an OAuth-enabled proxy. The NoSQL login token is cached and used to authorize subsequent operations.

Applications implement getAccessToken() and remain responsible for acquiring and maintaining OAuth tokens. By default, this provider calls that method again and performs a new login shortly before the current NoSQL login token expires. The server-returned expiration is bounded by both the validated OAuth token expiration and the configured store session timeout. Automatic re-login can be disabled with setAutoRenew(boolean).

OAuth access tokens and NoSQL login tokens are bearer credentials, so an HTTPS service endpoint is required.

  • Constructor Details

    • OAuthAccessTokenProvider

      public OAuthAccessTokenProvider()
      Creates a provider with automatic re-login enabled.
  • Method Details

    • close

      public void close()
      Closes the provider, releasing resources such as a stored login token.
      Specified by:
      close in interface AuthorizationProvider
    • flushCache

      public void flushCache()
      Invalidate the cached NoSQL login token.
      Specified by:
      flushCache in interface AuthorizationProvider
    • getLogger

      public Logger getLogger()
      Returns the logger, or null if not set.
      Returns:
      the logger
    • setLogger

      public OAuthAccessTokenProvider setLogger(Logger logger)
      Sets a Logger instance for this provider.
      Parameters:
      logger - the logger
      Returns:
      this
    • getEndpoint

      public String getEndpoint()
      Returns the endpoint of the authenticating entity
      Returns:
      the endpoint
    • setEndpoint

      public OAuthAccessTokenProvider setEndpoint(String endpoint)
      Sets the endpoint of the authenticating entity
      Parameters:
      endpoint - the endpoint
      Returns:
      this
      Throws:
      IllegalArgumentException - if the endpoint is not correctly formatted
    • setSslContext

      public OAuthAccessTokenProvider setSslContext(io.netty.handler.ssl.SslContext sslCtx)
      Sets the SSL context
      Parameters:
      sslCtx - the context
      Returns:
      this
    • setSslHandshakeTimeout

      public OAuthAccessTokenProvider setSslHandshakeTimeout(int timeoutMs)
      Sets the SSL handshake timeout in milliseconds
      Parameters:
      timeoutMs - the timeout in milliseconds
      Returns:
      this
    • isAutoRenew

      public boolean isAutoRenew()
      Returns whether the login token is to be automatically renewed.
      Returns:
      true if auto-renew is set
    • setAutoRenew

      public OAuthAccessTokenProvider setAutoRenew(boolean autoRenew)
      Sets the auto-renew state. If true, automatic renewal of the login token is enabled.
      Parameters:
      autoRenew - set to true to enable auto-renew
      Returns:
      this