#url #axum #signed #middleware #extractor #routing #build

axum-signed-urls

Signed URL middleware for Axum, via Extractors

2 releases

0.1.1 Feb 9, 2023
0.1.0 Feb 9, 2023

#25 in #signed

MIT license

12KB
132 lines

License Crates.io Docs.rs

axum-signed-urls

Signed URL middleware for Axum, using extractors.

Usage

use axum::{routing::get, Router};
use axum_signed_urls::{SignedUrl, build};

// This route will only be accessible if the URL is signed
async fn handler(_: SignedUrl) -> String {
    // This is how you create a signed URL
    build("/path", vec![("foo", "bar")].into_iter().collect()).unwrap()
}

A common issue with Axum extractors

The most often issue with this extractor is using it after one consuming body e.g. axum::extract::Json. To fix this rearrange extractors in your handler definition moving body consumption to the end, see details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~6.5–8.5MB
~156K SLoC