Can force 2FA authent

This commit is contained in:
2024-03-26 21:07:29 +01:00
parent 4bb515366d
commit dfb277d636
8 changed files with 63 additions and 16 deletions

View File

@ -16,6 +16,7 @@ pub struct AuthWebauthnRequest {
credential: PublicKeyCredential,
}
#[allow(clippy::too_many_arguments)]
pub async fn auth_webauthn(
id: Identity,
req: web::Json<AuthWebauthnRequest>,
@ -25,10 +26,6 @@ pub async fn auth_webauthn(
users: web::Data<Addr<UsersActor>>,
logger: ActionLogger,
) -> impl Responder {
if !SessionIdentity(Some(&id)).need_2fa_auth() {
return HttpResponse::Unauthorized().json("No 2FA required!");
}
let user_id = SessionIdentity(Some(&id)).user_id();
match manager.finish_authentication(&user_id, &req.opaque_state, &req.credential) {