mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-11 23:50:07 +01:00
feat: ToAuthorizationLayer
This commit is contained in:
parent
57fbc6e399
commit
d7d945c075
5 changed files with 124 additions and 28 deletions
|
|
@ -1,5 +1,7 @@
|
|||
use axum::{routing::get, Router};
|
||||
use jwt_authorizer::{error::InitError, AuthError, JwtAuthorizer, JwtClaims, Refresh, RefreshStrategy};
|
||||
use jwt_authorizer::{
|
||||
error::InitError, AuthError, JwtAuthorizer, JwtClaims, Refresh, RefreshStrategy, ToAuthorizationLayer,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use std::net::SocketAddr;
|
||||
use tower_http::trace::TraceLayer;
|
||||
|
|
@ -49,7 +51,7 @@ async fn main() -> Result<(), InitError> {
|
|||
let api = Router::new()
|
||||
.route("/protected", get(protected))
|
||||
// adding the authorizer layer
|
||||
.layer(jwt_auth.layer().await?);
|
||||
.layer(jwt_auth.to_layer().await?);
|
||||
|
||||
let app = Router::new()
|
||||
// public endpoint
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue