public class DefaultAuditLogProvider extends java.lang.Object implements AuditLogProvider
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log |
protected java.util.function.UnaryOperator<AuthorizationLogData> |
sanitizer |
Constructor and Description |
---|
DefaultAuditLogProvider() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
configure(java.util.Map<java.lang.String,?> configs) |
void |
logAuthorization(AuthorizationLogData data)
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) |
void |
setSanitizer(java.util.function.UnaryOperator<AuthorizationLogData> sanitizer)
Specifies a transformer that should be applied to the data if we decide to log it.
|
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) |
protected static final org.slf4j.Logger log
protected java.util.function.UnaryOperator<AuthorizationLogData> sanitizer
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 setSanitizer(java.util.function.UnaryOperator<AuthorizationLogData> sanitizer)
AuditLogProvider
setSanitizer
in interface AuditLogProvider
public void logAuthorization(AuthorizationLogData data)
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
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException