public class DefaultAuditLogProvider extends java.lang.Object implements AuditLogProvider
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log |
Constructor and Description |
---|
DefaultAuditLogProvider() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
configure(java.util.Map<java.lang.String,?> configs) |
void |
logAuthorization(RequestContext requestContext,
Action action,
AuthorizeResult authorizeResult,
AuthorizePolicy authorizePolicy)
Log using the same format as AK AclAuthorizer:
|
boolean |
providerConfigured(java.util.Map<java.lang.String,?> configs)
Returns true if minimal configs of this provider are included in the provided configs.
|
java.lang.String |
providerName()
Returns the name of this provider.
|
java.util.Set<java.lang.String> |
reconfigurableConfigs() |
void |
reconfigure(java.util.Map<java.lang.String,?> configs) |
java.util.concurrent.CompletionStage<java.lang.Void> |
start(org.apache.kafka.server.authorizer.AuthorizerServerInfo serverInfo,
java.util.Map<java.lang.String,?> interBrokerListenerConfigs)
Starts a provider and returns a future that is completed when the provider is ready.
|
boolean |
usesMetadataFromThisKafkaCluster()
Returns true if this provider uses metadata from a Kafka topic on this cluster.
|
void |
validateReconfiguration(java.util.Map<java.lang.String,?> configs) |
public void configure(java.util.Map<java.lang.String,?> configs)
configure
in interface org.apache.kafka.common.Configurable
public java.util.Set<java.lang.String> reconfigurableConfigs()
reconfigurableConfigs
in interface org.apache.kafka.common.Reconfigurable
public void validateReconfiguration(java.util.Map<java.lang.String,?> configs) throws org.apache.kafka.common.config.ConfigException
validateReconfiguration
in interface org.apache.kafka.common.Reconfigurable
org.apache.kafka.common.config.ConfigException
public void reconfigure(java.util.Map<java.lang.String,?> configs)
reconfigure
in interface org.apache.kafka.common.Reconfigurable
public java.util.concurrent.CompletionStage<java.lang.Void> start(org.apache.kafka.server.authorizer.AuthorizerServerInfo serverInfo, java.util.Map<java.lang.String,?> interBrokerListenerConfigs)
Provider
start
in interface Provider
serverInfo
- Runtime broker configuration metadatainterBrokerListenerConfigs
- Client configs for using inter-broker listener
For brokers that host metadata service, these client configs may be used to access metadata
topic if metadata client configs are not explicitly overridden. This avoids the need for
redundant configs for brokers in the metadata cluster.public java.lang.String providerName()
Provider
providerName
in interface Provider
public boolean usesMetadataFromThisKafkaCluster()
Provider
usesMetadataFromThisKafkaCluster
in interface Provider
public boolean providerConfigured(java.util.Map<java.lang.String,?> configs)
AuditLogProvider
providerConfigured
in interface AuditLogProvider
public void logAuthorization(RequestContext requestContext, Action action, AuthorizeResult authorizeResult, AuthorizePolicy authorizePolicy)
def logMessage: String = { val authResult = if (authorized) "Allowed" else "Denied" s"Principal = $principal is $authResult Operation = $operation from host = $host on resource = $resource" }
logAuthorization
in interface AuditLogProvider
requestContext
- Request context that contains details of the request that was being
authorized. This includes the user principal.action
- The action that was being authorized including resource and operation.authorizeResult
- Result of the authorization indicating if access was granted.authorizePolicy
- Details of the authorization policy that granted or denied access.
This includes any ACL/Role binding that produced the result.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException