public class AuthAttemptCache extends Object
| Constructor and Description |
|---|
AuthAttemptCache(long ttlMs,
int maxSize,
org.apache.kafka.common.utils.Time time,
int maxEntriesPerCleanup,
String sensorName,
org.apache.kafka.common.metrics.Metrics metrics)
Create an AuthAttemptCache.
|
AuthAttemptCache(String sensorName,
org.apache.kafka.common.metrics.Metrics metrics)
Create an AuthAttemptCache using default values of ttl and maxSize
|
| Modifier and Type | Method and Description |
|---|---|
String |
get(String username,
String password)
Return the hash for the [username, password] if any
|
void |
invalidate(String username,
String password)
Remove a cache entry, if it exists.
|
void |
put(String username,
String password,
String hash)
Cache an authorisation.
|
public AuthAttemptCache(long ttlMs,
int maxSize,
org.apache.kafka.common.utils.Time time,
int maxEntriesPerCleanup,
String sensorName,
org.apache.kafka.common.metrics.Metrics metrics)
ttl - How long to cache entries, in milliseconds.
The timer is reset on each access.maxSize - The maximum number of entries in the cache.
When necessary, the cache will evict the oldest elements.time - The Kafka time object to provide time.sensorName - A string to differentiate the hit rate metric when multiple
caches are in usemetrics - A metrics registry to create the hit rate sensor inpublic AuthAttemptCache(String sensorName, org.apache.kafka.common.metrics.Metrics metrics)
public String get(String username, String password)
username - The username.password - The password.public void put(String username, String password, String hash)
username - The username.password - The password.hash - The hash.