mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 14:54:33 +00:00
consider idp to be a valid mfa
This commit is contained in:
@@ -109,9 +109,10 @@ async function isSessionValid(session: Session): Promise<boolean> {
|
|||||||
const otpSms = session.factors.otpSms?.verifiedAt;
|
const otpSms = session.factors.otpSms?.verifiedAt;
|
||||||
const totp = session.factors.totp?.verifiedAt;
|
const totp = session.factors.totp?.verifiedAt;
|
||||||
const webAuthN = session.factors.webAuthN?.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
|
// must have one single check
|
||||||
mfaValid = !!(otpEmail || otpSms || totp || webAuthN);
|
mfaValid = !!(otpEmail || otpSms || totp || webAuthN || idp);
|
||||||
if (!mfaValid) {
|
if (!mfaValid) {
|
||||||
console.warn("Session has no valid multifactor", session.factors);
|
console.warn("Session has no valid multifactor", session.factors);
|
||||||
}
|
}
|
||||||
@@ -207,6 +208,8 @@ export async function GET(request: NextRequest) {
|
|||||||
|
|
||||||
const isValid = await isSessionValid(selectedSession);
|
const isValid = await isSessionValid(selectedSession);
|
||||||
|
|
||||||
|
console.log("Session is valid:", isValid);
|
||||||
|
|
||||||
if (!isValid && selectedSession.factors?.user) {
|
if (!isValid && selectedSession.factors?.user) {
|
||||||
// if the session is not valid anymore, we need to redirect the user to re-authenticate
|
// if the session is not valid anymore, we need to redirect the user to re-authenticate
|
||||||
const command: SendLoginnameCommand = {
|
const command: SendLoginnameCommand = {
|
||||||
|
|||||||
Reference in New Issue
Block a user