public class SpireJwtLoginCallbackHandler extends Object implements org.apache.kafka.common.security.auth.AuthenticateCallbackHandler
CallbackHandler
that recognizes OAuthBearerTokenCallback
and retrieves SPIFFE JWT from Spire Agent that is running at the endpoint provided via
the sasl.oauthbearer.token.spire.agent.endpoint
.
It also attaches the logical cluster this client is allowed to work with as a SASL extension.
For example:
sasl.oauthbearer.token.spire.agent.endpoint='<>' sasl.jaas.config= org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \ logicalCluster=' ';
This class should be explicitly set via the sasl.login.callback.handler.class
client configuration property.
Modifier and Type | Field and Description |
---|---|
static String |
SASL_OAUTHBEARER_TOKEN_SPIRE_AGENT_ENDPOINT |
Constructor and Description |
---|
SpireJwtLoginCallbackHandler() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
configure(Map<String,?> configs,
String saslMechanism,
List<AppConfigurationEntry> jaasConfigEntries) |
void |
handle(Callback[] callbacks) |
public static final String SASL_OAUTHBEARER_TOKEN_SPIRE_AGENT_ENDPOINT
public void configure(Map<String,?> configs, String saslMechanism, List<AppConfigurationEntry> jaasConfigEntries)
configure
in interface org.apache.kafka.common.security.auth.AuthenticateCallbackHandler
public void close()
close
in interface org.apache.kafka.common.security.auth.AuthenticateCallbackHandler
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
handle
in interface CallbackHandler
IOException
UnsupportedCallbackException