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 Details

    • brokerHost

      String brokerHost()
      Returns:
      the broker host this connection is being established to
    • getStateObject

      <T> Optional<T> getStateObject(Class<T> clazz)
      Retrieve an implementation-controlled state object previously stored with setStateObject(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 / CommandAuthResponse challenge rounds. A broker REFRESH_AUTH_DATA sentinel does not continue this exchange — ClientCnx begins 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

      <T> void setStateObject(Class<T> clazz, T value)
      Store a state object keyed by its (or any) class; a null value 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 class
      value - the state object, or null to remove the entry