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.
LocalUser
Authenticated local user session.
PeerSession
Authenticated remote peer session.
Implementations§
Source§impl VerifiedPrincipal
impl VerifiedPrincipal
Sourcepub fn local_admin(session_id: impl Into<String>) -> VerifiedPrincipal
pub fn local_admin(session_id: impl Into<String>) -> VerifiedPrincipal
Construct a verified local administrator principal.
Sourcepub fn local_user(
user_id: impl Into<String>,
session_id: impl Into<String>,
grants: impl IntoIterator<Item = OperationGrant>,
) -> VerifiedPrincipal
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.
Sourcepub fn peer_session(
peer_id: impl Into<String>,
member_id: impl Into<String>,
grants: impl IntoIterator<Item = OperationGrant>,
) -> VerifiedPrincipal
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.
Sourcepub fn principal_id(&self) -> String
pub fn principal_id(&self) -> String
Primary identity string for attribution and audit.
Sourcepub fn is_local_admin(&self) -> bool
pub fn is_local_admin(&self) -> bool
Check if this principal is a local administrator.
Sourcepub fn covering_grants<'a>(
&'a self,
required: &OperationGrant,
) -> Vec<&'a OperationGrant>
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.
Sourcepub fn has_grant(&self, required: &OperationGrant) -> bool
pub fn has_grant(&self, required: &OperationGrant) -> bool
Check if this principal holds the requested grant.
Trait Implementations§
Source§impl Clone for VerifiedPrincipal
impl Clone for VerifiedPrincipal
Source§fn clone(&self) -> VerifiedPrincipal
fn clone(&self) -> VerifiedPrincipal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VerifiedPrincipal
impl Debug for VerifiedPrincipal
impl Eq for VerifiedPrincipal
Source§impl PartialEq for VerifiedPrincipal
impl PartialEq for VerifiedPrincipal
impl StructuralPartialEq for VerifiedPrincipal
Auto Trait Implementations§
impl Forget for VerifiedPrincipal
impl Freeze for VerifiedPrincipal
impl Move for VerifiedPrincipal
impl RefUnwindSafe for VerifiedPrincipal
impl Send for VerifiedPrincipal
impl Sync for VerifiedPrincipal
impl Unpin for VerifiedPrincipal
impl UnsafeUnpin for VerifiedPrincipal
impl UnwindSafe for VerifiedPrincipal
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.