AuthAccessApi

Struct AuthAccessApi 

Source
pub struct AuthAccessApi;
Expand description

AuthAccessApi

§WHY THIS FILE EXISTS

This module defines the public authorization API exposed to:

  • macro-expanded endpoints
  • DSL-generated auth guards
  • higher-level application code

It intentionally sits between:

  • access::* (internal authorization logic)
  • dto::error::Error (external error surface)

Responsibilities:

  1. Error domain translation Access-layer errors are internal and must never leak directly. This API converts them into stable, user-facing error types.

  2. Signature normalization This is the canonical place to adapt access-layer contracts (e.g. &'static str policy constants) to callers.

  3. Stability during refactors Access internals may change freely as long as this API remains stable. Callers MUST NOT depend directly on access::*.

If this file appears repetitive, that is intentional. DO NOT collapse it into the access layer.

Implementations§

Source§

impl AuthAccessApi

Source

pub async fn require_all(rules: Vec<AccessRuleFn>) -> Result<(), Error>

Require that ALL access rules succeed.

Intended for use by DSL-expanded authorization pipelines.

Source

pub async fn require_any(rules: Vec<AccessRuleFn>) -> Result<(), Error>

Require that ANY access rule succeeds.

Source

pub async fn is_app_directory_role( caller: Principal, role: CanisterRole, ) -> Result<(), Error>

Source

pub async fn is_child(caller: Principal) -> Result<(), Error>

Source

pub async fn is_controller(caller: Principal) -> Result<(), Error>

Source

pub async fn is_parent(caller: Principal) -> Result<(), Error>

Source

pub async fn is_principal( caller: Principal, expected: Principal, ) -> Result<(), Error>

Source

pub async fn is_registered_to_subnet(caller: Principal) -> Result<(), Error>

Source

pub async fn caller_is_root(caller: Principal) -> Result<(), Error>

Source

pub async fn is_same_canister(caller: Principal) -> Result<(), Error>

Source

pub async fn is_subnet_directory_role( caller: Principal, role: CanisterRole, ) -> Result<(), Error>

Source

pub async fn is_whitelisted(caller: Principal) -> Result<(), Error>

Source

pub async fn verify_delegated_token() -> Result<(), Error>

Verify a delegated token read from the ingress payload.

Intended for DSL-generated auth guards only.

Source

pub async fn verify_token( token: DelegatedToken, authority_pid: Principal, now_secs: u64, ) -> Result<(), Error>

Source

pub async fn require_scope( claims: DelegatedTokenClaims, required_scope: &'static str, ) -> Result<(), Error>

Require that the delegated token includes a specific scope.

required_scope MUST be a compile-time policy constant.

Source

pub async fn require_audience( claims: DelegatedTokenClaims, required_audience: &'static str, ) -> Result<(), Error>

Require that the delegated token targets a specific audience.

required_audience MUST be a compile-time policy constant.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V