Package org.apache.kafka.common.security.oauthbearer
package org.apache.kafka.common.security.oauthbearer
Provides a
LoginModule for using OAuth Bearer Token authentication with Kafka clusters.-
ClassDescription
BrokerJwtValidatoris an implementation ofJwtValidatorthat is used by the broker to perform more extensive validation of the JWT access token that is received from the client, but ultimately from posting the client credentials to the OAuth/OIDC provider's token endpoint.ClientCredentialsJwtRetrieveris aJwtRetrieverthat performs the steps to request a JWT from an OAuth/OIDC identity provider using theclient_credentialsgrant type.ClientJwtValidatoris an implementation ofJwtValidatorthat is used by the client to perform some rudimentary validation of the JWT access token that is received as part of the response from posting the client credentials to the OAuth/OIDC provider's token endpoint.DefaultJwtRetrieverinstantiates and delegatesJwtRetrieverAPI calls to an embedded implementation based on configuration: If the value ofsasl.oauthbearer.token.endpoint.urlis set to a value that starts with thefileprotocol (e.g.ThisJwtValidatoruses the delegation approach, instantiating and delegating calls to a more concrete implementation.FileJwtRetrieveris anJwtRetrieverthat will load the contents of a file, interpreting them as a JWT access key in the serialized form.JwtBearerJwtRetrieveris aJwtRetrieverthat performs the steps to request a JWT from an OAuth/OIDC identity provider using theurn:ietf:params:oauth:grant-type:jwt-bearergrant type.AJwtRetrieveris the internal API by which the login module will retrieve an access token for use in authorization by the broker.AJwtRetrieverExceptionis thrown in cases where the JWT cannot be retrieved.An instance ofJwtValidatoracts as a function object that, given an access token in base-64 encoded JWT format, can parse the data, perform validation, and construct anOAuthBearerTokenfor use by the caller.AJwtValidatorExceptionis thrown in cases where the validity of a JWT cannot be determined.ACallbackfor use by theSaslServerimplementation when it needs to validate the SASL extensions for the OAUTHBEARER mechanism Callback handlers should use theOAuthBearerExtensionsValidatorCallback.valid(String)method to communicate valid extensions back to the SASL server.OAuthBearerLoginCallbackHandleris anAuthenticateCallbackHandlerthat acceptsOAuthBearerTokenCallbackandSaslExtensionsCallbackcallbacks to perform the steps to request a JWT from an OAuth/OIDC provider using theclient_credentials.TheLoginModulefor the SASL/OAUTHBEARER mechanism.Theb64tokenvalue as defined in RFC 6750 Section 2.1 along with the token's specific scope and lifetime and principal name.ACallbackfor use by theSaslClientandLoginimplementations when they require an OAuth 2 bearer token.ACallbackfor use by theSaslServerimplementation when it needs to provide an OAuth 2 bearer token compact serialization for validation.OAuthBearerValidatorCallbackHandleris anAuthenticateCallbackHandlerthat acceptsOAuthBearerValidatorCallbackandOAuthBearerExtensionsValidatorCallbackcallbacks to implement OAuth/OIDC validation.