Rocket.rs basic authentication
A high-level basic access authentication request guard for Rocket.rs ✨
02 Dec 2020 ShowcasesAbout
Recently, I’ve created a simple library called rocket-basicauth
which allows a high-level interface to basic access authentication using request guards, as an extension for the Rocket.rs web framework ✨
Demonstration
Here is the jist of the entire functionality of this library:
/// Hello route with `auth` request guard
#[get("/hello/<age>")]
fn hello(auth: BasicAuth, age: u8) -> String {
format!("Hello, {} year old named {}!", age, auth.name)
}
This example excludes the use rocket;
imports and main function setups and just shows the crux of this library; the “BasicAuth” structure, documented here.
Links
Here are some links to find out more about this quick library:
- Github: https://github.com/owez/rocket-basicauth
- Crates.io: https://crates.io/crates/rocket-basicauth
- Docs.rs: https://docs.rs/rocket-basicauth