Skip to main content

Authorizer

Trait Authorizer 

Source
pub trait Authorizer {
    // Required method
    fn authorize(&self, action: AuthAction<'_>) -> Authorization;

    // Provided method
    fn allows_everything(&self) -> bool { ... }
}
Expand description

The callback the binder consults before it binds an action.

Required Methods§

Source

fn authorize(&self, action: AuthAction<'_>) -> Authorization

Returns what to do about one action.

Provided Methods§

Source

fn allows_everything(&self) -> bool

Reports whether this authorizer allows every action unconditionally.

A plan cache may only reuse a compiled program when re-running the authorizer could not have changed the outcome, and the only authorizer that is true of is one that allows everything. Defaulting to false means an application’s authorizer opts out by doing nothing, which is the safe direction: a new authorizer that forgot to answer this question gets its callbacks, it does not get silently skipped.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§