public class KafkaAuthStore extends java.lang.Object implements AuthStore, ConsumerListener<AuthKey,AuthValue>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTH_TOPIC |
Constructor and Description |
---|
KafkaAuthStore(boolean isConfluentCloud,
io.confluent.security.authorizer.Scope scope,
org.apache.kafka.server.authorizer.internals.ConfluentAuthorizerServerInfo serverInfo) |
KafkaAuthStore(io.confluent.security.rbac.RbacRoles rbacRoles,
org.apache.kafka.common.utils.Time time,
io.confluent.security.authorizer.Scope scope,
org.apache.kafka.server.authorizer.internals.ConfluentAuthorizerServerInfo serverInfo,
int numAuthTopicPartitions) |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<java.net.URL> |
activeNodeUrls(java.lang.String protocol)
Returns the collection of URLS of currently active nodes.
|
DefaultAuthCache |
authCache()
Returns a cache that stores all data read from the auth topic.
|
void |
close() |
void |
configure(java.util.Map<java.lang.String,?> configs) |
protected org.apache.kafka.clients.admin.AdminClient |
createAdminClient(java.util.Map<java.lang.String,java.lang.Object> configs) |
protected org.apache.kafka.clients.consumer.Consumer<AuthKey,AuthValue> |
createConsumer(java.util.Map<java.lang.String,java.lang.Object> configs) |
protected MetadataNodeManager |
createNodeManager(java.util.Collection<java.net.URL> nodeUrls,
KafkaStoreConfig config,
KafkaAuthWriter writer,
org.apache.kafka.common.utils.Time time) |
protected org.apache.kafka.clients.producer.Producer<AuthKey,AuthValue> |
createProducer(java.util.Map<java.lang.String,java.lang.Object> configs) |
protected KafkaAuthWriter |
createWriter(int numPartitions,
KafkaStoreConfig clientConfig,
DefaultAuthCache authCache,
StatusListener statusListener,
org.apache.kafka.common.utils.Time time) |
boolean |
isMasterWriter()
Returns true if this node is currently the master writer.
|
java.lang.Integer |
masterWriterId()
Returns the broker id of the master writer.
|
java.net.URL |
masterWriterUrl(java.lang.String protocol)
Returns the URL of the master writer node for the specified protocol.
|
protected org.apache.kafka.common.metrics.Metrics |
metrics() |
void |
onConsumerRecord(org.apache.kafka.clients.consumer.ConsumerRecord<AuthKey,AuthValue> record,
AuthValue oldValue)
Notification of new record consumed by local reader
|
java.util.concurrent.CompletionStage<java.lang.Void> |
startReader()
Starts the metadata reader and returns a completion stage that is completed when
existing metadata from the store has been loaded into the cache.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
startService(java.util.Collection<java.net.URL> nodeUrls)
Starts the metadata coordinator and writer.
|
KafkaAuthWriter |
writer()
Returns a writer instance that can be used to update this store.
|
public static final java.lang.String AUTH_TOPIC
public KafkaAuthStore(boolean isConfluentCloud, io.confluent.security.authorizer.Scope scope, org.apache.kafka.server.authorizer.internals.ConfluentAuthorizerServerInfo serverInfo)
public KafkaAuthStore(io.confluent.security.rbac.RbacRoles rbacRoles, org.apache.kafka.common.utils.Time time, io.confluent.security.authorizer.Scope scope, org.apache.kafka.server.authorizer.internals.ConfluentAuthorizerServerInfo serverInfo, int numAuthTopicPartitions)
public void configure(java.util.Map<java.lang.String,?> configs)
configure
in interface org.apache.kafka.common.Configurable
public DefaultAuthCache authCache()
AuthStore
public java.util.concurrent.CompletionStage<java.lang.Void> startReader()
AuthStore
startReader
in interface AuthStore
public java.util.concurrent.CompletionStage<java.lang.Void> startService(java.util.Collection<java.net.URL> nodeUrls)
AuthStore
startService
in interface AuthStore
nodeUrls
- The URLs of metadata server hosting this store. Metadata server URLs must be
unique across the cluster since they are used as node ids for master writer
election. The URLs are also used for redirection of update requests to the
current master writer of the metadata service.public KafkaAuthWriter writer()
AuthStore
public boolean isMasterWriter()
AuthStore
isMasterWriter
in interface AuthStore
public java.net.URL masterWriterUrl(java.lang.String protocol)
AuthStore
masterWriterUrl
in interface AuthStore
protocol
- The protocol for which master writer is requested, e.g. httpspublic java.lang.Integer masterWriterId()
AuthStore
masterWriterId
in interface AuthStore
public java.util.Collection<java.net.URL> activeNodeUrls(java.lang.String protocol)
AuthStore
activeNodeUrls
in interface AuthStore
protocol
- The protocol for which node urls are requested, e.g. httpspublic void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public void onConsumerRecord(org.apache.kafka.clients.consumer.ConsumerRecord<AuthKey,AuthValue> record, AuthValue oldValue)
ConsumerListener
onConsumerRecord
in interface ConsumerListener<AuthKey,AuthValue>
record
- the record from consumeroldValue
- old value corresponding to record key from local cacheprotected org.apache.kafka.clients.consumer.Consumer<AuthKey,AuthValue> createConsumer(java.util.Map<java.lang.String,java.lang.Object> configs)
protected org.apache.kafka.clients.producer.Producer<AuthKey,AuthValue> createProducer(java.util.Map<java.lang.String,java.lang.Object> configs)
protected org.apache.kafka.clients.admin.AdminClient createAdminClient(java.util.Map<java.lang.String,java.lang.Object> configs)
protected MetadataNodeManager createNodeManager(java.util.Collection<java.net.URL> nodeUrls, KafkaStoreConfig config, KafkaAuthWriter writer, org.apache.kafka.common.utils.Time time)
protected KafkaAuthWriter createWriter(int numPartitions, KafkaStoreConfig clientConfig, DefaultAuthCache authCache, StatusListener statusListener, org.apache.kafka.common.utils.Time time)
protected org.apache.kafka.common.metrics.Metrics metrics()