rocket_simple_authorization/
lib.rs

1/*!
2# `simple-authorization` Request Guard for Rocket Framework
3
4This crate provides a request guard builder used for authorization.
5
6See `examples`.
7*/
8
9mod macros;
10
11#[macro_use]
12#[doc(hidden)]
13pub extern crate rocket;
14
15use rocket::request::Request;
16
17/// The trait for an authorizer.
18#[async_trait]
19pub trait SimpleAuthorization<'r>
20where
21    Self: Sized, {
22    /// Check whether the value in the `Authorization` header is valid or not. If it is valid, create a new instance of `Self`.
23    async fn authorizing(request: &'r Request<'_>, authorization: Option<&'r str>) -> Option<Self>;
24}