Merge factors type for authentication

This commit is contained in:
2022-11-11 12:26:02 +01:00
parent 8d231c0b45
commit af383720b7
44 changed files with 1177 additions and 674 deletions

View File

@ -1,5 +1,5 @@
use actix_identity::Identity;
use actix_web::{HttpRequest, HttpResponse, Responder, web};
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use webauthn_rs::prelude::PublicKeyCredential;
use crate::data::session_identity::{SessionIdentity, SessionStatus};
@ -11,10 +11,12 @@ pub struct AuthWebauthnRequest {
credential: PublicKeyCredential,
}
pub async fn auth_webauthn(id: Identity,
req: web::Json<AuthWebauthnRequest>,
manager: WebAuthManagerReq,
http_req: HttpRequest) -> impl Responder {
pub async fn auth_webauthn(
id: Identity,
req: web::Json<AuthWebauthnRequest>,
manager: WebAuthManagerReq,
http_req: HttpRequest,
) -> impl Responder {
if !SessionIdentity(Some(&id)).need_2fa_auth() {
return HttpResponse::Unauthorized().json("No 2FA required!");
}
@ -31,4 +33,4 @@ pub async fn auth_webauthn(id: Identity,
HttpResponse::InternalServerError().body("Failed to validate security key!")
}
}
}
}