chore: key file renaming

This commit is contained in:
cduvray 2023-02-12 09:04:38 +01:00
parent ae44a8e961
commit 9c45a43584
16 changed files with 20 additions and 83 deletions

View file

@ -180,19 +180,19 @@ mod tests {
#[tokio::test]
async fn build_from_file() {
let a = Authorizer::<Value>::build(&KeySourceType::RSA("../config/jwtRS256.key.pub".to_owned()), None, None)
let a = Authorizer::<Value>::build(&KeySourceType::RSA("../config/rsa-public1.pem".to_owned()), None, None)
.await
.unwrap();
let k = a.key_source.get_key(Header::new(Algorithm::RS256));
assert!(k.await.is_ok());
let a = Authorizer::<Value>::build(&KeySourceType::EC("../config/ec256-public.pem".to_owned()), None, None)
let a = Authorizer::<Value>::build(&KeySourceType::EC("../config/ecdsa-public1.pem".to_owned()), None, None)
.await
.unwrap();
let k = a.key_source.get_key(Header::new(Algorithm::ES256));
assert!(k.await.is_ok());
let a = Authorizer::<Value>::build(&KeySourceType::ED("../config/ed25519-public.pem".to_owned()), None, None)
let a = Authorizer::<Value>::build(&KeySourceType::ED("../config/ed25519-public1.pem".to_owned()), None, None)
.await
.unwrap();
let k = a.key_source.get_key(Header::new(Algorithm::EdDSA));

View file

@ -43,7 +43,7 @@ mod tests {
#[tokio::test]
async fn protected_without_jwt() {
let jwt_auth: JwtAuthorizer<User> = JwtAuthorizer::from_rsa_pem("../config/jwtRS256.key.pub");
let jwt_auth: JwtAuthorizer<User> = JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem");
let response = app(jwt_auth)
.await
@ -63,7 +63,7 @@ mod tests {
#[tokio::test]
async fn protected_with_jwt() {
let response = make_proteced_request(JwtAuthorizer::from_rsa_pem("../config/jwtRS256.key.pub"), JWT_RSA_OK).await;
let response = make_proteced_request(JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem"), JWT_RSA_OK).await;
assert_eq!(response.status(), StatusCode::OK);
@ -73,7 +73,7 @@ mod tests {
#[tokio::test]
async fn protected_with_bad_jwt() {
let response = make_proteced_request(JwtAuthorizer::from_rsa_pem("../config/jwtRS256.key.pub"), "xxx.xxx.xxx").await;
let response = make_proteced_request(JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem"), "xxx.xxx.xxx").await;
assert_eq!(response.status(), StatusCode::UNAUTHORIZED);
// TODO: check error code (https://datatracker.ietf.org/doc/html/rfc6750#section-3.1)
@ -82,7 +82,7 @@ mod tests {
#[tokio::test]
async fn protected_with_claims_check() {
let rsp_ok = make_proteced_request(
JwtAuthorizer::from_rsa_pem("../config/jwtRS256.key.pub").check(|_| true),
JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem").check(|_| true),
JWT_RSA_OK,
)
.await;
@ -90,7 +90,7 @@ mod tests {
assert_eq!(rsp_ok.status(), StatusCode::OK);
let rsp_ko = make_proteced_request(
JwtAuthorizer::from_rsa_pem("../config/jwtRS256.key.pub").check(|_| false),
JwtAuthorizer::from_rsa_pem("../config/rsa-public1.pem").check(|_| false),
JWT_RSA_OK,
)
.await;