Axum Auth

High-level http auth extractors for axum

Usage

Bearer Authentication:

```rust use axum_auth::AuthBearer;

/// Handler for a typical axum route, takes a token and returns it async fn handler(AuthBearer(token): AuthBearer) -> String { format!("Found a bearer token: {}", token) } ```

Basic Authentication:

```rust use axum_auth::AuthBasic;

/// Takes basic auth details and shows a message async fn handler(AuthBasic((id, password)): AuthBasic) -> String { if let Some(password) = password { format!("User '{}' with password '{}'", id, password) } else { format!("User '{}' without password", id) } } ```

Check out the crate documentation for more in-depth information into how both of these methods work!

Installation

Simply place the following inside of your Cargo.toml file:

toml [dependencies] axum-auth = "0.1"

Security

Some essential security considerations to take into account are the following:

Licensing

This project is dual-licensed under both the MIT and Apache, so feel free to use either at your discretion.