mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-11 23:50:07 +01:00
doc: multi authorizer
This commit is contained in:
parent
50c2ecac38
commit
36bc0fca7d
2 changed files with 9 additions and 2 deletions
|
|
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 0.11 (2023-xx-xx)
|
||||||
|
|
||||||
|
- support for multiple authorizers
|
||||||
|
- JwtAuthorizer.layer() deprecated in favor of JwtAuthorizer.into_layer()
|
||||||
|
|
||||||
## 0.10.1 (2023-07-11)
|
## 0.10.1 (2023-07-11)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,14 @@ JWT authoriser Layer for Axum and Tonic.
|
||||||
- Claims extraction
|
- Claims extraction
|
||||||
- Claims checker
|
- Claims checker
|
||||||
- Tracing support (error logging)
|
- Tracing support (error logging)
|
||||||
|
- *tonic* support
|
||||||
|
- multiple authorizers
|
||||||
|
|
||||||
|
|
||||||
## Usage Example
|
## Usage Example
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
# use jwt_authorizer::{AuthError, JwtAuthorizer, JwtClaims, RegisteredClaims};
|
# use jwt_authorizer::{AuthError, IntoLayer, JwtAuthorizer, JwtClaims, RegisteredClaims};
|
||||||
# use axum::{routing::get, Router};
|
# use axum::{routing::get, Router};
|
||||||
# use serde::Deserialize;
|
# use serde::Deserialize;
|
||||||
|
|
||||||
|
|
@ -32,7 +34,7 @@ JWT authoriser Layer for Axum and Tonic.
|
||||||
|
|
||||||
// adding the authorization layer
|
// adding the authorization layer
|
||||||
let app = Router::new().route("/protected", get(protected))
|
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)
|
// proteced handler with user injection (mapping some jwt claims)
|
||||||
async fn protected(JwtClaims(user): JwtClaims<RegisteredClaims>) -> Result<String, AuthError> {
|
async fn protected(JwtClaims(user): JwtClaims<RegisteredClaims>) -> Result<String, AuthError> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue