Skip to main content

Gatekeeper

Struct Gatekeeper 

Source
pub struct Gatekeeper<R, A = NoopAuditSink, C = IdentityReasonCatalog, W = NoopPolicyObserver> { /* private fields */ }
Expand description

Axum-friendly authorization boundary.

Implementations§

Source§

impl<R> Gatekeeper<R>

Source

pub fn new(resolver: R) -> Self

Creates a gatekeeper with no-op audit and identity reason rendering.

Source§

impl<R, A, C, W> Gatekeeper<R, A, C, W>

Source

pub fn with_audit_sink<NextAudit>( self, audit_sink: NextAudit, ) -> Gatekeeper<R, NextAudit, C, W>

Replaces the audit sink.

Source

pub fn with_reason_catalog<NextCatalog>( self, reason_catalog: NextCatalog, ) -> Gatekeeper<R, A, NextCatalog, W>

Replaces the reason catalog used for forbidden denials.

Source

pub fn with_observer<NextObserver>( self, observer: NextObserver, ) -> Gatekeeper<R, A, C, NextObserver>

Replaces the side-channel decision observer.

Source

pub fn with_denial_response(self, denial_response: DenialResponseConfig) -> Self

Replaces denial presentation settings.

Source

pub const fn with_audit_subjects(self, audit_subjects: AuditSubjects) -> Self

Controls whether audit entries include tenant and principal identifiers.

Source§

impl<R, A, C, W> Gatekeeper<R, A, C, W>

Source

pub async fn authorize<O>( &self, policy_id: PolicyId, policy: &Policy<O>, context: Context, ) -> Result<Authorized<O>, GatekeepRejection<R::Error, A::Error>>
where O: Lattice + Serialize + Send + Sync,

Resolves facts, evaluates the policy, observes and audits the decision, and returns an axum rejection for denied requests.

Trait Implementations§

Source§

impl<R, A, C, W> Clone for Gatekeeper<R, A, C, W>

Source§

fn clone(&self) -> Self

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

Auto Trait Implementations§

§

impl<R, A, C, W> Freeze for Gatekeeper<R, A, C, W>

§

impl<R, A, C, W> RefUnwindSafe for Gatekeeper<R, A, C, W>

§

impl<R, A, C, W> Send for Gatekeeper<R, A, C, W>
where R: Sync + Send, A: Sync + Send, C: Sync + Send, W: Sync + Send,

§

impl<R, A, C, W> Sync for Gatekeeper<R, A, C, W>
where R: Sync + Send, A: Sync + Send, C: Sync + Send, W: Sync + Send,

§

impl<R, A, C, W> Unpin for Gatekeeper<R, A, C, W>

§

impl<R, A, C, W> UnsafeUnpin for Gatekeeper<R, A, C, W>

§

impl<R, A, C, W> UnwindSafe for Gatekeeper<R, A, C, W>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> 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 = 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.