Interface AuthenticationCallContext
public interface AuthenticationCallContext
The per-call context for binary-protocol authentication (PIP-478).
Carries the broker host and exposes a per-exchange state slot for retaining conversation state across challenge-response rounds. Most implementations produce the same credential for every call and never inspect the broker host.
-
Method Summary
Modifier and TypeMethodDescription<T> Optional<T> getStateObject(Class<T> clazz) Retrieve an implementation-controlled state object previously stored withsetStateObject(Class, T).<T> voidsetStateObject(Class<T> clazz, T value) Store a state object keyed by its (or any) class; anullvalue removes the entry.
-
Method Details
-
brokerHost
String brokerHost()- Returns:
- the broker host this connection is being established to
-
getStateObject
Retrieve an implementation-controlled state object previously stored withsetStateObject(Class, T). The slot is keyed by class so the pieces of one plugin — which, under the capability-factory model, may be separate internal classes participating in the same exchange (e.g. the initial-data provider and the challenge handler on one binary connect) — can each keep state without collision; impls typically store one object of their own type (e.g. their SASL conversation state).The slot's lifetime equals one authentication exchange: for the binary protocol, one connection attempt and all of its ordinary
CommandAuthChallenge/CommandAuthResponsechallenge rounds. A brokerREFRESH_AUTH_DATAsentinel does not continue this exchange —ClientCnxbegins a new exchange with a fresh context and a fresh slot — so conversation state does not survive a refresh. Concurrent authentications to different brokers get their own context with their own slots, so multiple in-flight handshakes don't collide.- Type Parameters:
T- the state object type- Parameters:
clazz- the state object's key class- Returns:
- the stored object, if present
-
setStateObject
Store a state object keyed by its (or any) class; anullvalue removes the entry. Implementations should key with a private class of their own (e.g. their conversation record) to avoid collisions. Rounds of one exchange are serialized by the framework, so slot access within an exchange needs no synchronization.- Type Parameters:
T- the state object type- Parameters:
clazz- the key classvalue- the state object, ornullto remove the entry
-