pub struct Principal<I = ()> {
pub name: String,
pub identity: I,
}Expand description
The identity a successful Dispatch::authenticate resolves to. Stored
on the Session and fed to Dispatch::capabilities for the HELLO
reply (SRV-014).
Fields§
§name: StringProduct-defined principal name (user, key id, …).
identity: IThe product’s own resolved identity — roles, permissions, quotas, tenant, whatever authorization actually needs.
Before this existed a product could only carry the name, so every
privileged command had to re-resolve the user from its credential
store. That was not merely a cost: the second lookup reads live state,
so a user edited or deleted mid-session was evaluated against the new
record. Carrying the identity here restores the other semantics —
captured at AUTH, stable for the session — and makes the choice
the product’s rather than an accident of the transport.
Defaults to () for products that only need the name.