Interface AccessTokenRetriever

All Superinterfaces:
AutoCloseable, Closeable, Initable
All Known Implementing Classes:
FileTokenRetriever, HttpAccessTokenRetriever

public interface AccessTokenRetriever extends Initable, Closeable
An AccessTokenRetriever is the internal API by which the login module will retrieve an access token for use in authorization by the broker. The implementation may involve authentication to a remote system, or it can be as simple as loading the contents of a file or configuration setting. Retrieval is a separate concern from validation, so it isn't necessary for the AccessTokenRetriever implementation to validate the integrity of the JWT access token.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Lifecycle method to perform a clean shutdown of the retriever.
    Retrieves a JWT access token in its serialized three-part form.

    Methods inherited from interface org.apache.kafka.common.security.oauthbearer.secured.Initable

    init
  • Method Details

    • retrieve

      String retrieve() throws IOException
      Retrieves a JWT access token in its serialized three-part form. The implementation is free to determine how it should be retrieved but should not perform validation on the result. Note: This is a blocking function and callers should be aware that the implementation may be communicating over a network, with the file system, coordinating threads, etc. The facility in the LoginModule from which this is ultimately called does not provide an asynchronous approach.
      Returns:
      Non-null JWT access token string
      Throws:
      IOException - Thrown on errors related to IO during retrieval
    • close

      default void close() throws IOException
      Lifecycle method to perform a clean shutdown of the retriever. This must be performed by the caller to ensure the correct state, freeing up and releasing any resources performed in Initable.init().
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - Thrown on errors related to IO during closure