Created
October 4, 2021 13:57
-
-
Save mike820324/092ce4fc20205a24f8f4ad7629fd7183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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