Skip to main content

VerifiedPrincipal

Enum VerifiedPrincipal 

Source
pub enum VerifiedPrincipal {
    LocalAdmin {
        session_id: String,
    },
    LocalUser {
        user_id: String,
        session_id: String,
        grants: BTreeSet<OperationGrant>,
    },
    PeerSession {
        peer_id: String,
        authenticated_member_id: String,
        grants: BTreeSet<OperationGrant>,
    },
}
Expand description

Verified principal constructing an internal, non-serializable proof of authority.

Notice: VerifiedPrincipal deliberately does NOT implement Deserialize. A remote payload cannot forge or select an administrative identity or member to bypass endpoint verification.

Variants§

§

LocalAdmin

In-process local administrator authority.

Fields

§session_id: String
§

LocalUser

Authenticated local user session.

Fields

§user_id: String
§session_id: String
§

PeerSession

Authenticated remote peer session.

Fields

§peer_id: String
§authenticated_member_id: String

Implementations§

Source§

impl VerifiedPrincipal

Source

pub fn local_admin(session_id: impl Into<String>) -> VerifiedPrincipal

Construct a verified local administrator principal.

Source

pub fn local_user( user_id: impl Into<String>, session_id: impl Into<String>, grants: impl IntoIterator<Item = OperationGrant>, ) -> VerifiedPrincipal

Construct an authenticated local user principal with initial grants.

Source

pub fn peer_session( peer_id: impl Into<String>, member_id: impl Into<String>, grants: impl IntoIterator<Item = OperationGrant>, ) -> VerifiedPrincipal

Construct an authenticated remote peer principal with initial grants.

Source

pub fn principal_id(&self) -> String

Primary identity string for attribution and audit.

Source

pub fn is_local_admin(&self) -> bool

Check if this principal is a local administrator.

Source

pub fn covering_grants<'a>( &'a self, required: &OperationGrant, ) -> Vec<&'a OperationGrant>

Held grants that cover the required grant.

A local administrator’s authority is implicit rather than grant-based, so this returns an empty set for it even though Self::has_grant reports true.

Source

pub fn has_grant(&self, required: &OperationGrant) -> bool

Check if this principal holds the requested grant.

Trait Implementations§

Source§

impl Clone for VerifiedPrincipal

Source§

fn clone(&self) -> VerifiedPrincipal

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VerifiedPrincipal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for VerifiedPrincipal

Source§

impl PartialEq for VerifiedPrincipal

Source§

fn eq(&self, other: &VerifiedPrincipal) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VerifiedPrincipal

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.