Gotham middleware for AWS SigV4 verification

Crate: gothammiddlewareawssigverify

The gotham_middleware_aws_sig_verify crate integrates AWS SigV4 verification (from awssigverify) into the Gotham web framework.

Assuming you have a function get_signing_key that can return signing keys given AWS access keys (and optionally tokens), integration would be done similarly to:

```rust use gotham; use gotham::pipeline::newpipeline; use gotham::pipeline::single::singlepipeline; use gotham::router::builder::{buildrouter, DefineSingleRoute, DrawRoutes}; use gotham::router::Router; use gotham::state::State; use gothammiddlewareawssig_verify::{AWSSigV4Verifier, SigningKeyKind, SignatureError}; use http::status::StatusCode; use hyper::{Body, Response};

const SERVICE: &str = "myservice"; const REGION: &str = "local";

fn router() -> Router { let verifier = AWSSigV4Verifier::new(getsigningkey, SERVICE, REGION); let (chain, pipelines) = singlepipeline(newpipeline().add(verifier).build()); buildrouter(chain, pipelines, |route| { route.get("/").to(myhandler); }) }

fn my_handler(state: State) -> (State, Response) { let response: Response = Response::builder() .header("Content-Type", "text/plain; charset=utf-8") .status(StatusCode::OK) .body(Body::from("OK")) .unwrap();

(state, response)

}

fn getsigningkey( kind: SigningKeyKind, accesskeyid: &str, sessiontoken: Option<&str>, reqdateopt: Option<&str>, regionopt: Option<&str>, service_opt: Option<&str> ) -> Result, SignatureError> { ... }

pub fn main() { gotham::start("127.0.0.1:8080", router()) } ```