Skip to main content

Session

Trait Session 

Source
pub trait Session:
    Send
    + Sync
    + Debug {
    // Required methods
    fn session_id(&self) -> &str;
    fn principal(&self) -> &str;
    fn is_expired(&self) -> bool;
    fn client_ip(&self) -> &str;
}
Expand description

Unified session trait for all authentication mechanisms.

Provides a common interface for session handling across:

  • AuthSession (RBAC/ACL with SASL authentication)
  • ServiceSession (API keys, mTLS, OIDC client credentials)

This enables handler code to work with any authenticated session without knowing the specific authentication mechanism.

Required Methods§

Source

fn session_id(&self) -> &str

Unique session identifier

Source

fn principal(&self) -> &str

The authenticated principal/identity name

Source

fn is_expired(&self) -> bool

Whether this session has expired

Source

fn client_ip(&self) -> &str

Client IP address that created this session

Implementors§