doc: multi authorizer

This commit is contained in:
cduvray 2023-08-14 08:04:53 +02:00
parent 50c2ecac38
commit 36bc0fca7d
2 changed files with 9 additions and 2 deletions

View file

@ -14,12 +14,14 @@ JWT authoriser Layer for Axum and Tonic.
- Claims extraction
- Claims checker
- Tracing support (error logging)
- *tonic* support
- multiple authorizers
## Usage Example
```rust
# use jwt_authorizer::{AuthError, JwtAuthorizer, JwtClaims, RegisteredClaims};
# use jwt_authorizer::{AuthError, IntoLayer, JwtAuthorizer, JwtClaims, RegisteredClaims};
# use axum::{routing::get, Router};
# use serde::Deserialize;
@ -32,7 +34,7 @@ JWT authoriser Layer for Axum and Tonic.
// adding the authorization layer
let app = Router::new().route("/protected", get(protected))
.layer(jwt_auth.layer().await.unwrap());
.layer(jwt_auth.into_layer().await.unwrap());
// proteced handler with user injection (mapping some jwt claims)
async fn protected(JwtClaims(user): JwtClaims<RegisteredClaims>) -> Result<String, AuthError> {