[][src]Crate rocket_basicauth

Tests Docs

A high-level basic access authentication request guard for Rocket.rs

Example

#![feature(proc_macro_hygiene, decl_macro)]

#[macro_use] extern crate rocket;

use rocket_basicauth::BasicAuth;

/// Hello route with `auth` request guard, containing a `name` and `password`
#[get("/hello/<age>")]
fn hello(auth: BasicAuth, age: u8) -> String {
    format!("Hello, {} year old named {}!", age, auth.name)
}

fn main() {
    rocket::ignite().mount("/", routes![hello]).launch();
}

Installation

Simply add the following to your Cargo.toml file:

[dependencies]
rocket-basicauth = "1"

Structs

BasicAuth

A high-level basic access authentication request guard implementation, containing the name and password used for authentication

Enums

BasicAuthError

Contains errors relating to the BasicAuth request guard