feat(SW-162): MFA expiry set with token expiry

This commit is contained in:
Hrishikesh Vaipurkar
2024-08-14 11:16:48 +02:00
parent 84670dbd14
commit 6ef4da125d

View File

@@ -109,12 +109,13 @@ export const config = {
const mfa_scope = const mfa_scope =
profile?.amr == profile?.amr ==
"urn:se:curity:authentication:otp-authenticator:OTP-Authenticator_web" "urn:se:curity:authentication:otp-authenticator:OTP-Authenticator_web"
const mfa_expires_at = mfa_scope ? Date.now() + 10 * 60 * 1000 : 0 const tokenExpiry = account.expires_at
? account.expires_at * 1000
: undefined
const mfa_expires_at = mfa_scope && tokenExpiry ? tokenExpiry : 0
return { return {
access_token: account.access_token, access_token: account.access_token,
expires_at: account.expires_at expires_at: tokenExpiry,
? account.expires_at * 1000
: undefined,
refresh_token: account.refresh_token, refresh_token: account.refresh_token,
loginType, loginType,
mfa_scope: mfa_scope, mfa_scope: mfa_scope,