refactor: simplification ToAuthorizationLayer -> IntoLayer

This commit is contained in:
cduvray 2023-08-14 08:02:56 +02:00
parent 0fbdc0df84
commit 50c2ecac38
5 changed files with 20 additions and 22 deletions

View file

@ -1,7 +1,5 @@
use axum::{routing::get, Router};
use jwt_authorizer::{
error::InitError, AuthError, JwtAuthorizer, JwtClaims, Refresh, RefreshStrategy, ToAuthorizationLayer,
};
use jwt_authorizer::{error::InitError, AuthError, IntoLayer, JwtAuthorizer, JwtClaims, Refresh, RefreshStrategy};
use serde::Deserialize;
use std::net::SocketAddr;
use tower_http::trace::TraceLayer;
@ -51,7 +49,7 @@ async fn main() -> Result<(), InitError> {
let api = Router::new()
.route("/protected", get(protected))
// adding the authorizer layer
.layer(jwt_auth.to_layer().await?);
.layer(jwt_auth.into_layer().await?);
let app = Router::new()
// public endpoint