Struct biscuit_wasm::Authorizer
source · [−]pub struct Authorizer { /* private fields */ }
Expand description
The Authorizer verifies a request according to its policies and the provided token
Implementations
sourceimpl Authorizer
impl Authorizer
pub fn new() -> Authorizer
pub fn add_token(&mut self, token: Biscuit)
sourcepub fn add_check(&mut self, check: Check) -> Result<(), JsValue>
pub fn add_check(&mut self, check: Check) -> Result<(), JsValue>
Adds a check
All checks, from authorizer and token, must be validated to authorize the request
sourcepub fn add_policy(&mut self, policy: Policy) -> Result<(), JsValue>
pub fn add_policy(&mut self, policy: Policy) -> Result<(), JsValue>
Adds a policy
The authorizer will test all policies in order of addition and stop at the first one that matches. If it is a “deny” policy, the request fails, while with an “allow” policy, it will succeed
sourcepub fn add_code(&mut self, source: &str) -> Result<(), JsValue>
pub fn add_code(&mut self, source: &str) -> Result<(), JsValue>
Adds facts, rules, checks and policies as one code block
Runs the authorization checks and policies
Returns the index of the matching allow policy, or an error containing the matching deny policy or a list of the failing checks
Trait Implementations
sourceimpl Default for Authorizer
impl Default for Authorizer
sourcefn default() -> Authorizer
fn default() -> Authorizer
Returns the “default value” for a type. Read more
sourceimpl From<Authorizer> for JsValue
impl From<Authorizer> for JsValue
sourcefn from(value: Authorizer) -> Self
fn from(value: Authorizer) -> Self
Converts to this type from the input type.
sourceimpl FromWasmAbi for Authorizer
impl FromWasmAbi for Authorizer
sourceimpl IntoWasmAbi for Authorizer
impl IntoWasmAbi for Authorizer
sourceimpl OptionFromWasmAbi for Authorizer
impl OptionFromWasmAbi for Authorizer
sourceimpl OptionIntoWasmAbi for Authorizer
impl OptionIntoWasmAbi for Authorizer
sourceimpl RefFromWasmAbi for Authorizer
impl RefFromWasmAbi for Authorizer
type Anchor = Ref<'static, Authorizer>
type Anchor = Ref<'static, Authorizer>
The type that holds the reference to
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous. Read moresourceunsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
sourceimpl RefMutFromWasmAbi for Authorizer
impl RefMutFromWasmAbi for Authorizer
type Anchor = RefMut<'static, Authorizer>
type Anchor = RefMut<'static, Authorizer>
Same as
RefFromWasmAbi::Anchor
sourceunsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abi
sourceimpl WasmDescribe for Authorizer
impl WasmDescribe for Authorizer
Auto Trait Implementations
impl RefUnwindSafe for Authorizer
impl Send for Authorizer
impl Sync for Authorizer
impl Unpin for Authorizer
impl UnwindSafe for Authorizer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
sourcefn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
. Read more