pub struct ApiKeyPrincipal {
pub prefix: String,
pub namespace: String,
pub subject: String,
pub scopes: Vec<String>,
pub mode: ApiKeyMode,
}Expand description
A verified key’s answer to “who is calling, and what may they do?”.
Fields§
§prefix: StringThe public prefix the request presented.
namespace: StringThe app-chosen namespace the key was issued under.
subject: StringThe opaque subject (tenant/account id) the key speaks for.
scopes: Vec<String>What the key may do; the gate checks one of these per request.
mode: ApiKeyModeWhich environment the key belongs to.
Implementations§
Source§impl ApiKeyPrincipal
impl ApiKeyPrincipal
Sourcepub fn has_scope(&self, scope: &str) -> bool
pub fn has_scope(&self, scope: &str) -> bool
Whether the key carries scope; scopes are exact-match strings.
Sourcepub fn rate_limit_key(&self) -> String
pub fn rate_limit_key(&self) -> String
The per-key rate-limit key apikey:<prefix>: a
RateLimitPolicy arm matching that prefix
sets the key’s budget, the way rate_limit_keys’ ip:/email:
keys slot into the shared limiter (issue #538).
Sourcepub fn to_subject(&self) -> Subject
pub fn to_subject(&self) -> Subject
The Subject this key speaks for, for
code shared with the session auth port; the session id is the
prefix, so instant revocation already exists — revoke the key.
Trait Implementations§
Source§impl Clone for ApiKeyPrincipal
impl Clone for ApiKeyPrincipal
Source§impl Debug for ApiKeyPrincipal
impl Debug for ApiKeyPrincipal
impl Eq for ApiKeyPrincipal
Source§impl PartialEq for ApiKeyPrincipal
impl PartialEq for ApiKeyPrincipal
impl StructuralPartialEq for ApiKeyPrincipal
Auto Trait Implementations§
impl Freeze for ApiKeyPrincipal
impl RefUnwindSafe for ApiKeyPrincipal
impl Send for ApiKeyPrincipal
impl Sync for ApiKeyPrincipal
impl Unpin for ApiKeyPrincipal
impl UnsafeUnpin for ApiKeyPrincipal
impl UnwindSafe for ApiKeyPrincipal
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<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
Compare self to
key and return true if they are equal.