pub struct LifecycleUser {
pub username: String,
pub email: Option<String>,
pub provider: Option<String>,
}Expand description
Minimal user view handed to lifecycle hooks.
The legacy static OAuth/JWT path doesn’t always have a fully
resolved User (with a populated Role) at every hook site —
login fires before role resolution, logout only knows the session
subject. LifecycleUser is the common denominator both paths can
always produce: a username plus the optional email + provider that
were available. Hooks that need the full RBAC role read it from the
Context they receive elsewhere.
Fields§
§username: StringStable subject identifier (username / sub).
email: Option<String>Email, when the authenticating path knew it.
provider: Option<String>Authenticating provider ("github", "google", "basic",
"jwt", …) when known.
Implementations§
Source§impl LifecycleUser
impl LifecycleUser
Sourcepub fn from_username(username: impl Into<String>) -> Self
pub fn from_username(username: impl Into<String>) -> Self
Build a LifecycleUser from a username only.
Sourcepub fn from_identity(identity: &AuthIdentity) -> Self
pub fn from_identity(identity: &AuthIdentity) -> Self
Derive a LifecycleUser from an AuthIdentity.
Trait Implementations§
Source§impl Clone for LifecycleUser
impl Clone for LifecycleUser
Source§fn clone(&self) -> LifecycleUser
fn clone(&self) -> LifecycleUser
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LifecycleUser
impl Debug for LifecycleUser
Source§impl Default for LifecycleUser
impl Default for LifecycleUser
Source§fn default() -> LifecycleUser
fn default() -> LifecycleUser
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for LifecycleUser
impl<'de> Deserialize<'de> for LifecycleUser
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LifecycleUser
impl RefUnwindSafe for LifecycleUser
impl Send for LifecycleUser
impl Sync for LifecycleUser
impl Unpin for LifecycleUser
impl UnsafeUnpin for LifecycleUser
impl UnwindSafe for LifecycleUser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more