mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-12 16:10:06 +01:00
chore: clippy
This commit is contained in:
parent
d7d945c075
commit
55c4f7cc16
2 changed files with 7 additions and 7 deletions
|
|
@ -275,7 +275,7 @@ where
|
|||
.and_then(|c| c.get(name.as_str()).map(String::from)),
|
||||
};
|
||||
|
||||
let authorizers: Vec<Arc<Authorizer<C>>> = self.auths.iter().map(|a| a.clone()).collect();
|
||||
let authorizers: Vec<Arc<Authorizer<C>>> = self.auths.iter().cloned().collect();
|
||||
|
||||
Box::pin(async move {
|
||||
if let Some(token) = token_o {
|
||||
|
|
@ -292,12 +292,12 @@ where
|
|||
// services down the stack.
|
||||
request.extensions_mut().insert(tdata);
|
||||
|
||||
return Ok(request);
|
||||
Ok(request)
|
||||
}
|
||||
Err(err) => return Err(err), // TODO: error containing all errors (not just the last one)
|
||||
Err(err) => Err(err), // TODO: error containing all errors (not just the last one)
|
||||
}
|
||||
} else {
|
||||
return Err(AuthError::MissingToken());
|
||||
Err(AuthError::MissingToken())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -398,7 +398,7 @@ where
|
|||
pub fn new(inner: S, auths: Vec<Arc<Authorizer<C>>>, jwt_source: JwtSource) -> AsyncAuthorizationService<S, C> {
|
||||
Self {
|
||||
inner,
|
||||
auths: auths,
|
||||
auths,
|
||||
jwt_source,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use std::{
|
|||
use axum::{response::Response, routing::get, Json, Router};
|
||||
use http::{header::AUTHORIZATION, Request, StatusCode};
|
||||
use hyper::Body;
|
||||
use jwt_authorizer::{JwtAuthorizer, JwtClaims, Refresh, RefreshStrategy};
|
||||
use jwt_authorizer::{JwtAuthorizer, JwtClaims, Refresh, RefreshStrategy, ToAuthorizationLayer};
|
||||
use lazy_static::lazy_static;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
|
@ -104,7 +104,7 @@ async fn app(jwt_auth: JwtAuthorizer<User>) -> Router {
|
|||
let protected_route: Router = Router::new()
|
||||
.route("/protected", get(protected_handler))
|
||||
.route("/protected-with-user", get(protected_with_user))
|
||||
.layer(jwt_auth.layer().await.unwrap());
|
||||
.layer(jwt_auth.to_layer().await.unwrap());
|
||||
|
||||
Router::new().merge(pub_route).merge(protected_route)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue