Class FileTokenRetriever

java.lang.Object
org.apache.kafka.common.security.oauthbearer.secured.FileTokenRetriever
All Implemented Interfaces:
Closeable, AutoCloseable, AccessTokenRetriever, Initable

public class FileTokenRetriever extends Object implements AccessTokenRetriever
FileTokenRetriever is an AccessTokenRetriever that will load the contents, interpreting them as a JWT access key in the serialized form.
See Also:
  • Constructor Details

    • FileTokenRetriever

      public FileTokenRetriever(Path accessTokenFile)
  • Method Details

    • init

      public void init() throws IOException
      Description copied from interface: Initable
      Lifecycle method to perform any one-time initialization of the retriever. This must be performed by the caller to ensure the correct state before methods are invoked.
      Specified by:
      init in interface Initable
      Throws:
      IOException - Thrown on errors related to IO during initialization
    • retrieve

      public String retrieve() throws IOException
      Description copied from interface: AccessTokenRetriever
      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.
      Specified by:
      retrieve in interface AccessTokenRetriever
      Returns:
      Non-null JWT access token string
      Throws:
      IOException - Thrown on errors related to IO during retrieval