Skip to content

Commit 19174b5

Browse files
committed
fix(lib): handle MfaRoleTimeoutException
* We want to catch this specific exception and according to it hide cancel button in step-up dialog and also force authentication with both factors.
1 parent dcd6971 commit 19174b5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

libs/perun/services/src/lib/ApiInterceptor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export class ApiInterceptor implements HttpInterceptor {
129129
if (
130130
e.type === 'MfaPrivilegeException' ||
131131
e.type === 'MfaRolePrivilegeException' ||
132-
e.type === 'MfaTimeoutException'
132+
e.type === 'MfaTimeoutException' ||
133+
e.type === 'MfaRoleTimeoutException'
133134
) {
134135
return this.mfaHandlerService.openMfaWindow(e.type).pipe(
135136
switchMap((verified) => {

libs/perun/services/src/lib/mfa-handler.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { StoreService } from './store.service';
1414
export type MfaExceptionType =
1515
| 'MfaPrivilegeException'
1616
| 'MfaRolePrivilegeException'
17-
| 'MfaTimeoutException';
17+
| 'MfaTimeoutException'
18+
| 'MfaRoleTimeoutException';
1819

1920
@Injectable({
2021
providedIn: 'root',
@@ -42,14 +43,15 @@ export class MfaHandlerService {
4243
const configVerify = getDefaultDialogConfig();
4344
configVerify.width = '450px';
4445
configVerify.data = {
45-
mfaRoleException: mfaExceptionType === 'MfaRolePrivilegeException',
46+
mfaRoleException:
47+
mfaExceptionType === ('MfaRolePrivilegeException' || 'MfaRoleTimeoutException'),
4648
};
4749
const dialogVerifyRef = this.dialog.open(MfaRequiredDialogComponent, configVerify);
4850
let verificationSkipped = false;
4951

5052
dialogVerifyRef.afterClosed().subscribe((result) => {
5153
if (result) {
52-
if (mfaExceptionType === 'MfaTimeoutException') {
54+
if (mfaExceptionType === ('MfaTimeoutException' || 'MfaRoleTimeoutException')) {
5355
localStorage.setItem('mfaTimeout', 'true');
5456
}
5557

0 commit comments

Comments
 (0)