Trait rustmacaroon::Caveat
source · pub trait Caveat {
type Error;
type Context;
// Required method
fn verify(&self, ctx: &Self::Context) -> Result<(), Self::Error>;
}Expand description
Trait implementing the verification logic for a caveat. This trait need only be implemeted on the server-side. Clients wanting to add their own caveats to tokens don’t need this trait.
Required Associated Types§
Required Methods§
sourcefn verify(&self, ctx: &Self::Context) -> Result<(), Self::Error>
fn verify(&self, ctx: &Self::Context) -> Result<(), Self::Error>
Verify the caveat. Use the context for any information needed to properly check caveats.
This method should return Ok(()) if the caveat passes (i.e. the client is allowed to do what
they’re attempting to do) or Err(...) if the caveat prohibits the action the bearer is
attempting.