Package oracle.jdbc

Interface AccessToken


  • public interface AccessToken
    An access token generated by an authentication service. Subtypes of this interface represent different token formats. This interface defines factory methods for creating instances of AccessToken subtypes that Oracle JDBC supports when authenticating with Oracle Database.
    Since:
    23
    • Method Detail

      • createJsonWebToken

        static AccessToken createJsonWebToken​(char[] token,
                                              PrivateKey privateKey)

        Creates an AccessToken representing a JSON Web Token (JWT) that requires proof of possession (PoP) of a privateKey. The token argument to this method must be provided as a string of characters representing a JSON Web Token (JWT) as specified by RFC 7519.

        Proof of possession is specified by RFC 7800.

        The returned AccessToken retains copies of the token and privateKey provided to this method. After this method returns, the original token and privateKey may be mutated or destroyed by the caller.

        Parameters:
        token - JWT encoded token. Not null.
        privateKey - Private key for which the token requires proof of possession. Not null.
        Returns:
        An AccessToken representing a JWT that requires proof of possession of a private key.
        Throws:
        IllegalArgumentException - If the token or privateKey are null or have an unrecognized encoding.
        IllegalStateException - If security providers required to decode the privateKey are not installed.
      • createJsonWebTokenCache

        static java.util.function.Supplier<? extends AccessToken> createJsonWebTokenCache​(java.util.function.Supplier<? extends AccessToken> tokenSupplier)

        Returns a Supplier that caches JSON web tokens (JWTs) generated by a tokenSupplier. The tokenSupplier must output instances of AccessToken created by createJsonWebToken(char[], PrivateKey).

        The caching Supplier returned by this method retains a single JWT AccessToken in its cache which it will continue to output until that token is about to expire, and then it will obtain a new token from the tokenSupplier.

        The caching Supplier returned by this method initially retains an empty cache. The get method of the tokenSupplier is not invoked until the get method of the caching Supplier has been invoked.

        The caching Supplier returned will not perform concurrent invocations of tokenSupplier.get().

        The caching Supplier returned by this method does not handle unchecked Exceptions thrown by the tokenSupplier.

        The caching Supplier returned by this method throws NullPointerException if the tokenSupplier returns a null value.

        The caching Supplier returned by this method throws IllegalArgumentException if the tokenSupplier returns an AccessToken that is not recongized as one created by createJsonWebToken(char[], PrivateKey).

        Parameters:
        tokenSupplier - Supplier of JWT AccessTokens instances. Not null. Retained.
        Returns:
        A caching token supplier