A high-level basic access authentication request guard for Rocket.rs
```rust
use rocket_basicauth::BasicAuth;
/// Hello route with auth
request guard, containing a name
and password
fn hello(auth: BasicAuth, age: u8) -> String { format!("Hello, {} year old named {}!", age, auth.username) }
fn rocket() -> _ { rocket::build().mount("/", routes![hello]) } ```
Simply add the following to your Cargo.toml
file:
toml
[dependencies]
rocket-basicauth = "2"
By default, this crate uses the log
library to automatically add minimal trace-level logging, to disable this, instead write:
toml
[dependencies]
rocket-basicauth = { version = "2", default-features = false }
Support for Rocket 0.4 is decrepit in the eyes of this crate but may still be used by changing the version, to do this, instead write:
toml
[dependencies]
rocket-basicauth = "1"
Some essential security considerations to take into account are the following: