Package org.asynchttpclient.scram
Class ScramSessionCache
- java.lang.Object
-
- org.asynchttpclient.scram.ScramSessionCache
-
public class ScramSessionCache extends Object
Thread-safe cache for SCRAM reauthentication data (RFC 7804 ยง5.1). Keyed by (host, port, realm). Stores derived keys (NOT SaltedPassword).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScramSessionCache.CacheKeyCache key: (host, port, realm).static classScramSessionCache.EntryCached session entry for reauthentication.
-
Constructor Summary
Constructors Constructor Description ScramSessionCache()ScramSessionCache(int maxEntries)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidconfirmNonceCount(ScramSessionCache.CacheKey key)Confirm nonce-count after successful reauthentication.@Nullable ScramSessionCache.Entryget(ScramSessionCache.CacheKey key)booleanisSrFresh(ScramSessionCache.Entry entry)Check if the sr value is still fresh.voidput(ScramSessionCache.CacheKey key, ScramSessionCache.Entry entry)intreserveNonceCount(ScramSessionCache.CacheKey key)Atomically reserve and increment the nonce-count for use in a request.voidrollbackNonceCount(ScramSessionCache.CacheKey key)Rollback nonce-count on failure or stale response by decrementing.intsize()voidupdateSr(ScramSessionCache.CacheKey key, String newSr, int newTtl)Update the server nonce (sr) after a stale response.
-
-
-
Method Detail
-
put
public void put(ScramSessionCache.CacheKey key, ScramSessionCache.Entry entry)
-
get
@Nullable public @Nullable ScramSessionCache.Entry get(ScramSessionCache.CacheKey key)
-
updateSr
public void updateSr(ScramSessionCache.CacheKey key, String newSr, int newTtl)
Update the server nonce (sr) after a stale response.
-
isSrFresh
public boolean isSrFresh(ScramSessionCache.Entry entry)
Check if the sr value is still fresh. If ttl == -1: always fresh (no expiration). If ttl >= 0: check elapsed time since sr was received.
-
reserveNonceCount
public int reserveNonceCount(ScramSessionCache.CacheKey key)
Atomically reserve and increment the nonce-count for use in a request. Call rollbackNonceCount on failure to undo.
-
confirmNonceCount
public void confirmNonceCount(ScramSessionCache.CacheKey key)
Confirm nonce-count after successful reauthentication. No-op since already incremented.
-
rollbackNonceCount
public void rollbackNonceCount(ScramSessionCache.CacheKey key)
Rollback nonce-count on failure or stale response by decrementing.
-
clear
public void clear()
-
size
public int size()
-
-