WEB-233: Improve the OIDC integration with 2FA (#2616)

This commit is contained in:
AllsVeam
2025-09-01 13:55:35 -06:00
committed by GitHub
parent 801dd3fdfe
commit 6ee9f4d4d2
66 changed files with 4425 additions and 135 deletions
+23 -9
View File
@@ -32,6 +32,8 @@ import { animate, style, transition, trigger } from '@angular/animations';
import { I18nService } from './core/i18n/i18n.service';
import { ThemingService } from './shared/theme-toggle/theming.service';
import { AuthService } from './zitadel/auth.service';
/** Initialize Logger */
const log = new Logger('MifosX');
@@ -90,6 +92,8 @@ export class WebAppComponent implements OnInit {
i18nService: I18nService;
isLoggedIn = false;
/**
* @param {Router} router Router for navigation.
* @param {ActivatedRoute} activatedRoute Activated Route.
@@ -117,7 +121,8 @@ export class WebAppComponent implements OnInit {
private themingService: ThemingService,
private dateUtils: Dates,
private idle: IdleTimeoutService,
private dialog: MatDialog
private dialog: MatDialog,
private authService: AuthService
) {}
@HostBinding('class') public cssClass: string;
@@ -133,6 +138,11 @@ export class WebAppComponent implements OnInit {
*
* 4) Alerts
*/
login() {
this.authService.login();
}
ngOnInit() {
this.themingService.theme.subscribe((value: string) => {
this.cssClass = value;
@@ -222,14 +232,18 @@ export class WebAppComponent implements OnInit {
// Subscribe to session timeout If IdleTimeout is higher than 0 (zero)
if (environment.session.timeout.idleTimeout > 0) {
this.idle.$onSessionTimeout.subscribe(() => {
if (this.authenticationService.getUserLoggedIn()) {
this.alertService.alert({
type: 'Session timeout',
message: this.translateService.instant('labels.text.Session timed out')
});
this.dialog.open(SessionTimeoutDialogComponent);
this.logout();
}
this.alertService.alert({
type: 'Session timeout',
message: this.translateService.instant('labels.text.Session timed out')
});
this.dialog.open(SessionTimeoutDialogComponent);
setTimeout(() => {
if (environment.OIDC.oidcServerEnabled) {
this.logout();
} else {
this.authService.logout();
}
}, 1000);
});
}
}