Struct biscuit_auth::token::verifier::Verifier[][src]

pub struct Verifier { /* fields omitted */ }

used to check authorization policies on a token

can be created from Biscuit::verify or Verifier::new

Implementations

impl Verifier[src]

pub fn new() -> Result<Self, Logic>[src]

creates a new empty verifier

this can be used to check policies when:

  • there is no token (unauthenticated case)
  • there is a lot of data to load in the verifier on each check

In the latter case, we can create an empty verifier, load it with the facts, rules and checks, and each time a token must be checked, clone the verifier and load the token with Verifier::add_token

pub fn from(slice: &[u8]) -> Result<Self, Token>[src]

pub fn save(&self) -> Result<Vec<u8>, Token>[src]

pub fn add_token(
    &mut self,
    token: &Biscuit,
    root: PublicKey
) -> Result<(), Token>
[src]

Loads a token’s facts, rules and checks in a verifier

pub fn add_fact<F: TryInto<Fact>>(&mut self, fact: F) -> Result<(), Token>[src]

add a fact to the verifier

pub fn add_rule<R: TryInto<Rule>>(&mut self, rule: R) -> Result<(), Token>[src]

add a rule to the verifier

pub fn query<R: TryInto<Rule>, T: TryFrom<Fact, Error = E>, E: Into<Token>>(
    &mut self,
    rule: R
) -> Result<Vec<T>, Token>
[src]

run a query over the verifier’s Datalog engine to gather data

pub fn query_with_limits<R: TryInto<Rule>, T: TryFrom<Fact, Error = E>, E: Into<Token>>(
    &mut self,
    rule: R,
    limits: VerifierLimits
) -> Result<Vec<T>, Token>
[src]

run a query over the verifier’s Datalog engine to gather data

this method can specify custom runtime limits

pub fn add_check<R: TryInto<Check>>(&mut self, check: R) -> Result<(), Token>[src]

add a check to the verifier

pub fn add_resource(&mut self, resource: &str)[src]

pub fn add_operation(&mut self, operation: &str)[src]

pub fn set_time(&mut self)[src]

adds a fact with the current time

pub fn revocation_check(&mut self, ids: &[i64])[src]

pub fn add_policy<R: TryInto<Policy>>(&mut self, policy: R) -> Result<(), Token>[src]

add a policy to the verifier

pub fn allow(&mut self) -> Result<(), Token>[src]

pub fn deny(&mut self) -> Result<(), Token>[src]

pub fn verify(&mut self) -> Result<usize, Token>[src]

checks all the checks

on error, this can return a list of all the failed checks on success, it returns the index of the policy that matched

pub fn verify_with_limits(
    &mut self,
    limits: VerifierLimits
) -> Result<usize, Token>
[src]

checks all the checks

on error, this can return a list of all the failed checks

this method can specify custom runtime limits

pub fn print_world(&self) -> String[src]

prints the content of the verifier

pub fn dump(&self) -> (Vec<Fact>, Vec<Rule>, Vec<Check>)[src]

returns all of the data loaded in the verifier

Trait Implementations

impl Clone for Verifier[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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