#[non_exhaustive]pub struct Principal {
pub user_id: Uuid,
pub subject: String,
pub email: Option<String>,
pub name: Option<String>,
pub roles: Vec<String>,
}Expand description
The authenticated caller.
user_id is the local User row every caller has (ADR-0021 § 3); subject is who the
provider says it is. roles decide #[require_role]; rules that depend on data take the
principal in their params and decide in the use case.
#[non_exhaustive]: built with Principal::new and the with_* methods, so a new field
later breaks no one.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.user_id: Uuid§subject: String§email: Option<String>§name: Option<String>§roles: Vec<String>Implementations§
Source§impl Principal
impl Principal
Trait Implementations§
impl Eq for Principal
impl StructuralPartialEq for Principal
Auto Trait Implementations§
impl Freeze for Principal
impl RefUnwindSafe for Principal
impl Send for Principal
impl Sync for Principal
impl Unpin for Principal
impl UnsafeUnpin for Principal
impl UnwindSafe for Principal
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