pub struct CapabilityToken {
pub version: u8,
pub token_id: String,
pub allowed_namespaces: Vec<String>,
pub tenant_id: Option<String>,
pub project_id: Option<String>,
pub capabilities: TokenCapabilities,
pub issued_at: u64,
pub expires_at: u64,
pub acl_tags: Vec<String>,
pub signature: Vec<u8>,
}Expand description
A capability token that encodes access permissions
This is the serializable form that can be passed across API boundaries.
Fields§
§version: u8Token version (for future upgrades)
token_id: StringToken ID (for revocation tracking)
allowed_namespaces: Vec<String>Allowed namespaces (non-empty)
tenant_id: Option<String>Optional tenant ID
project_id: Option<String>Optional project ID
capabilities: TokenCapabilitiesCapability flags
issued_at: u64Issued at (Unix timestamp)
expires_at: u64Expires at (Unix timestamp)
ACL tags the token holder can access (for row-level ACLs)
signature: Vec<u8>Signature (HMAC-SHA256 or Ed25519)
Implementations§
Source§impl CapabilityToken
impl CapabilityToken
Sourcepub const CURRENT_VERSION: u8 = 1
pub const CURRENT_VERSION: u8 = 1
Current token version
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if the token is expired
Sourcepub fn is_namespace_allowed(&self, namespace: &str) -> bool
pub fn is_namespace_allowed(&self, namespace: &str) -> bool
Check if a namespace is allowed
Sourcepub fn to_auth_scope(&self) -> AuthScope
pub fn to_auth_scope(&self) -> AuthScope
Convert to AuthScope for use with FilterIR
Sourcepub fn remaining_validity(&self) -> Option<Duration>
pub fn remaining_validity(&self) -> Option<Duration>
Get remaining validity duration
Trait Implementations§
Source§impl Clone for CapabilityToken
impl Clone for CapabilityToken
Source§fn clone(&self) -> CapabilityToken
fn clone(&self) -> CapabilityToken
Returns a duplicate of the value. Read more
1.0.0 · 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 CapabilityToken
impl Debug for CapabilityToken
Source§impl<'de> Deserialize<'de> for CapabilityToken
impl<'de> Deserialize<'de> for CapabilityToken
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 CapabilityToken
impl RefUnwindSafe for CapabilityToken
impl Send for CapabilityToken
impl Sync for CapabilityToken
impl Unpin for CapabilityToken
impl UnsafeUnpin for CapabilityToken
impl UnwindSafe for CapabilityToken
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more