mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-13 00:20:08 +01:00
feat: implement IntoLayer for slices (IntoIter)
This commit is contained in:
parent
36bc0fca7d
commit
efa378b3bf
2 changed files with 3 additions and 2 deletions
|
|
@ -209,8 +209,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<C> IntoLayer<C> for Vec<JwtAuthorizer<C>>
|
impl<C, T> IntoLayer<C> for T
|
||||||
where
|
where
|
||||||
|
T: IntoIterator<Item = JwtAuthorizer<C>> + Send + Sync,
|
||||||
C: Clone + DeserializeOwned + Send + Sync,
|
C: Clone + DeserializeOwned + Send + Sync,
|
||||||
{
|
{
|
||||||
async fn into_layer(self) -> Result<AsyncAuthorizationLayer<C>, InitError> {
|
async fn into_layer(self) -> Result<AsyncAuthorizationLayer<C>, InitError> {
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ mod tests {
|
||||||
proteced_request_with_header(auths, header::COOKIE.as_str(), &format!("ccc={}", common::JWT_RSA1_OK)).await;
|
proteced_request_with_header(auths, header::COOKIE.as_str(), &format!("ccc={}", common::JWT_RSA1_OK)).await;
|
||||||
assert_eq!(response.status(), StatusCode::OK);
|
assert_eq!(response.status(), StatusCode::OK);
|
||||||
|
|
||||||
let auths: Vec<JwtAuthorizer<User>> = vec![
|
let auths: [JwtAuthorizer<User>; 2] = [
|
||||||
JwtAuthorizer::from_ec_pem("../config/ecdsa-public1.pem"),
|
JwtAuthorizer::from_ec_pem("../config/ecdsa-public1.pem"),
|
||||||
JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem").jwt_source(JwtSource::Cookie("ccc".to_owned())),
|
JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem").jwt_source(JwtSource::Cookie("ccc".to_owned())),
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue