mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-11 23:50:07 +01:00
Fix tonic test
This commit is contained in:
parent
77949d6a3a
commit
62b75a8c72
1 changed files with 3 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ use std::{sync::Once, task::Poll};
|
||||||
use axum::body::HttpBody;
|
use axum::body::HttpBody;
|
||||||
use futures_core::future::BoxFuture;
|
use futures_core::future::BoxFuture;
|
||||||
use http::header::AUTHORIZATION;
|
use http::header::AUTHORIZATION;
|
||||||
use jwt_authorizer::{layer::AuthorizationService, IntoLayer, JwtAuthorizer};
|
use jwt_authorizer::{layer::AuthorizationService, IntoLayer, JwtAuthorizer, Validation};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tonic::{server::UnaryService, transport::NamedService, IntoRequest, Status};
|
use tonic::{server::UnaryService, transport::NamedService, IntoRequest, Status};
|
||||||
use tower::{buffer::Buffer, Service};
|
use tower::{buffer::Buffer, Service};
|
||||||
|
|
@ -181,7 +181,8 @@ where
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn successfull_auth() {
|
async fn successfull_auth() {
|
||||||
init_test();
|
init_test();
|
||||||
let auth: JwtAuthorizer<User> = JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem");
|
let auth: JwtAuthorizer<User> =
|
||||||
|
JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem").validation(Validation::new().aud(&["aud1"]));
|
||||||
let app = app(auth, "b@b.com".to_string()).await;
|
let app = app(auth, "b@b.com".to_string()).await;
|
||||||
let r = make_protected_request(app.clone(), Some(JWT_RSA1_OK), "world").await.unwrap();
|
let r = make_protected_request(app.clone(), Some(JWT_RSA1_OK), "world").await.unwrap();
|
||||||
assert_eq!(r.get_ref().message, "Hello, world");
|
assert_eq!(r.get_ref().message, "Hello, world");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue