#[non_exhaustive]pub struct AuthIdentity {
pub name: String,
pub role: String,
pub method: AuthMethod,
pub raw_token: Option<SecretString>,
pub sub: Option<String>,
}Expand description
Identity of an authenticated caller.
The Debug impl is manually written to redact the raw bearer token
and the JWT sub claim. This prevents accidental disclosure if an
AuthIdentity is ever logged via tracing::debug!(?identity, …) or
format!("{identity:?}"). Only name, role, and method are printed
in the clear; raw_token and sub are rendered as <redacted> /
<present> / <none> markers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringHuman-readable identity name (e.g. API key label or cert CN).
role: StringRBAC role associated with this identity.
method: AuthMethodWhich authentication mechanism produced this identity.
raw_token: Option<SecretString>Raw bearer token from the Authorization header, wrapped in
SecretString so it is never accidentally logged or serialized.
Present for OAuth JWT; None for mTLS and API-key auth.
Tool handlers use this for downstream token passthrough via
crate::rbac::current_token.
sub: Option<String>JWT sub claim (stable user identifier, e.g. Keycloak UUID).
Used for token store keying. None for non-JWT auth.
Trait Implementations§
Source§impl Clone for AuthIdentity
impl Clone for AuthIdentity
Source§fn clone(&self) -> AuthIdentity
fn clone(&self) -> AuthIdentity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more