Skip to content

Instantly share code, notes, and snippets.

@mike820324
Created October 4, 2021 13:57
Show Gist options
  • Save mike820324/092ce4fc20205a24f8f4ad7629fd7183 to your computer and use it in GitHub Desktop.
Save mike820324/092ce4fc20205a24f8f4ad7629fd7183 to your computer and use it in GitHub Desktop.
#[actix_web::main]
async fn main() {
let app = App::new()
.wrap_fn(|req, srv| {
match authn_authz_check(req) {
Ok(_) => srv.call(req),
Err(_) => HttpResponse.Unauthorized().finish()
}
})
.route(
"/",
web::get().to(|| async {
"Hello, middleware!"
}),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment