Class DefaultJwtRetriever
java.lang.Object
org.apache.kafka.common.security.oauthbearer.DefaultJwtRetriever
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.kafka.common.security.oauthbearer.internals.secured.OAuthBearerConfigurable
,JwtRetriever
DefaultJwtRetriever
instantiates and delegates JwtRetriever
API calls to an embedded implementation
based on configuration:
-
If the value of
sasl.oauthbearer.token.endpoint.url
is set to a value that starts with thefile
protocol (e.g.file:/tmp/path/to/a/static-jwt.json
), an instance ofFileJwtRetriever
will be used as the underlyingJwtRetriever
. Otherwise, the URL is assumed to be an HTTP/HTTPS-based URL, and an instance ofClientCredentialsRequestFormatter
will be created and used.
JwtRetriever
classes will likely differ. Please refer to the
official Apache Kafka documentation for more information on these, and related configuration.-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultJwtRetriever
public DefaultJwtRetriever()
-
-
Method Details
-
configure
public void configure(Map<String, ?> configs, String saslMechanism, List<AppConfigurationEntry> jaasConfigEntries) - Specified by:
configure
in interfaceorg.apache.kafka.common.security.oauthbearer.internals.secured.OAuthBearerConfigurable
-
retrieve
Description copied from interface:JwtRetriever
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 theLoginModule
from which this is ultimately called does not provide an asynchronous approach.- Specified by:
retrieve
in interfaceJwtRetriever
- Returns:
- Non-
null
JWT access token string - Throws:
JwtRetrieverException
- Thrown on errors related to IO during retrieval
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.apache.kafka.common.security.oauthbearer.internals.secured.OAuthBearerConfigurable
- Throws:
IOException
-