consider idp to be a valid mfa

This commit is contained in:
Max Peintner
2024-12-16 11:42:57 +01:00
parent 53c0892614
commit 01b7d47551

View File

@@ -109,9 +109,10 @@ async function isSessionValid(session: Session): Promise<boolean> {
const otpSms = session.factors.otpSms?.verifiedAt;
const totp = session.factors.totp?.verifiedAt;
const webAuthN = session.factors.webAuthN?.verifiedAt;
const idp = session.factors.intent?.verifiedAt; // TODO: forceMFA should not consider this as valid factor
// must have one single check
mfaValid = !!(otpEmail || otpSms || totp || webAuthN);
mfaValid = !!(otpEmail || otpSms || totp || webAuthN || idp);
if (!mfaValid) {
console.warn("Session has no valid multifactor", session.factors);
}
@@ -207,6 +208,8 @@ export async function GET(request: NextRequest) {
const isValid = await isSessionValid(selectedSession);
console.log("Session is valid:", isValid);
if (!isValid && selectedSession.factors?.user) {
// if the session is not valid anymore, we need to redirect the user to re-authenticate
const command: SendLoginnameCommand = {