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
@@ -7,6 +7,10 @@ import { Router, ActivatedRoute, RouterLink } from '@angular/router';
import { SystemService } from '../../system.service';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
/** Custom Service Zitadel */
import { environment } from '../../../../environments/environment';
import { AuthService } from 'app/zitadel/auth.service';
/**
* Add Role Component.
*/
@@ -21,6 +25,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
export class AddRoleComponent implements OnInit {
/** Role form. */
roleForm: UntypedFormGroup;
/** Add role zitadel */
/**
* @param {FormBuilder} formBuilder Form Builder.
@@ -32,7 +37,8 @@ export class AddRoleComponent implements OnInit {
private formBuilder: UntypedFormBuilder,
private systemService: SystemService,
private route: ActivatedRoute,
private router: Router
private router: Router,
private authService: AuthService
) {}
/**
@@ -64,6 +70,9 @@ export class AddRoleComponent implements OnInit {
*/
submit() {
this.systemService.createRole(this.roleForm.value).subscribe((response: any) => {
if (environment.OIDC.oidcServerEnabled) {
this.authService.createRole(response.resourceId, this.roleForm.value.name, this.roleForm.value.description);
}
this.router.navigate(['../'], { relativeTo: this.route });
});
}
@@ -7,6 +7,10 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { SystemService } from '../../system.service';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
/** Custom Service Zitadel */
import { environment } from '../../../../environments/environment';
import { AuthService } from 'app/zitadel/auth.service';
/**
* Edit Role Description Component.
*/
@@ -35,7 +39,8 @@ export class EditRoleComponent implements OnInit {
private formBuilder: UntypedFormBuilder,
private systemService: SystemService,
private route: ActivatedRoute,
private router: Router
private router: Router,
private authService: AuthService
) {
this.route.data.subscribe((data: { role: any }) => {
this.roleData = data.role;
@@ -71,6 +76,13 @@ export class EditRoleComponent implements OnInit {
*/
submit() {
this.systemService.updateRole(this.roleForm.value, this.roleData.id).subscribe(() => {
if (environment.OIDC.oidcServerEnabled) {
this.authService.updateRole(
this.roleData.id,
this.roleForm.get('name')?.value,
this.roleForm.value.description
);
}
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
@@ -18,6 +18,10 @@ import { MatDivider } from '@angular/material/divider';
import { MatCheckbox } from '@angular/material/checkbox';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
/** Custom Service Zitadel */
import { environment } from '../../../../environments/environment';
import { AuthService } from 'app/zitadel/auth.service';
/**
* View Role and Permissions Component
*/
@@ -68,6 +72,7 @@ export class ViewRoleComponent implements OnInit {
permissions: {
permissions: { code: string; id: number }[];
} = { permissions: [] };
/** Add role zitadel */
/**
* Retrieves the roledetails data from `resolve`.
@@ -84,7 +89,8 @@ export class ViewRoleComponent implements OnInit {
private router: Router,
private formBuilder: UntypedFormBuilder,
private translateService: TranslateService,
public dialog: MatDialog
public dialog: MatDialog,
private authService: AuthService
) {
this.route.data.subscribe((data: { roledetails: any }) => {
this.rolePermissionService = data.roledetails;
@@ -281,6 +287,9 @@ export class ViewRoleComponent implements OnInit {
deleteRoleDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.systemService.deleteRole(this.roleId).subscribe(() => {
if (environment.OIDC.oidcServerEnabled) {
this.authService.deleteRole(this.roleId);
}
this.router.navigate(['/system/roles-and-permissions']);
});
} else {