diff --git a/console/src/app/modules/idp-table/idp-table.component.html b/console/src/app/modules/idp-table/idp-table.component.html
index 0e7b67606b..7fb4e4341f 100644
--- a/console/src/app/modules/idp-table/idp-table.component.html
+++ b/console/src/app/modules/idp-table/idp-table.component.html
@@ -86,16 +86,15 @@
|
diff --git a/console/src/app/modules/idp-table/idp-table.component.scss b/console/src/app/modules/idp-table/idp-table.component.scss
index aca73e03ea..3673a1759c 100644
--- a/console/src/app/modules/idp-table/idp-table.component.scss
+++ b/console/src/app/modules/idp-table/idp-table.component.scss
@@ -40,10 +40,6 @@ td {
tr {
outline: none;
- &.disabled * {
- opacity: .8;
- }
-
button {
visibility: hidden;
}
@@ -53,6 +49,12 @@ tr {
visibility: visible;
}
}
+
+ &.disabled,
+ &.disabled * {
+ opacity: .8;
+ cursor: default;
+ }
}
.avatar {
diff --git a/console/src/app/modules/idp/idp.component.html b/console/src/app/modules/idp/idp.component.html
index 698cc513da..5a34d37e62 100644
--- a/console/src/app/modules/idp/idp.component.html
+++ b/console/src/app/modules/idp/idp.component.html
@@ -24,7 +24,7 @@
-
@@ -46,7 +46,7 @@
{{ 'IDP.CLIENTID' | translate }}
-
Update Client Secret
@@ -69,7 +69,7 @@
+ removable (removed)="removeScope(scope)" [disabled]="(canWrite | async) === false">
{{scope}} cancel
@@ -96,7 +96,7 @@
diff --git a/console/src/app/modules/idp/idp.component.ts b/console/src/app/modules/idp/idp.component.ts
index a147d94589..55a37a9e76 100644
--- a/console/src/app/modules/idp/idp.component.ts
+++ b/console/src/app/modules/idp/idp.component.ts
@@ -1,15 +1,16 @@
import { COMMA, ENTER, SPACE } from '@angular/cdk/keycodes';
import { Location } from '@angular/common';
-import { Component, Injector, OnDestroy, OnInit, Type } from '@angular/core';
+import { Component, Injector, OnDestroy, Type } from '@angular/core';
import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms';
import { MatChipInputEvent } from '@angular/material/chips';
import { ActivatedRoute, Params } from '@angular/router';
-import { Subscription } from 'rxjs';
-import { switchMap, take } from 'rxjs/operators';
+import { Observable, Subject } from 'rxjs';
+import { switchMap, take, takeUntil } from 'rxjs/operators';
import { UpdateIDPOIDCConfigRequest, UpdateIDPRequest } from 'src/app/proto/generated/zitadel/admin_pb';
import { IDPStylingType, OIDCMappingField } from 'src/app/proto/generated/zitadel/idp_pb';
import { UpdateOrgIDPOIDCConfigRequest, UpdateOrgIDPRequest } from 'src/app/proto/generated/zitadel/management_pb';
import { AdminService } from 'src/app/services/admin.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
@@ -20,7 +21,7 @@ import { PolicyComponentServiceType } from '../policies/policy-component-types.e
templateUrl: './idp.component.html',
styleUrls: ['./idp.component.scss'],
})
-export class IdpComponent implements OnInit, OnDestroy {
+export class IdpComponent implements OnDestroy {
public mappingFields: OIDCMappingField[] = [];
public styleFields: IDPStylingType[] = [];
@@ -29,17 +30,22 @@ export class IdpComponent implements OnInit, OnDestroy {
private service!: ManagementService | AdminService;
public readonly separatorKeysCodes: number[] = [ENTER, COMMA, SPACE];
- private subscription?: Subscription;
+ private destroy$: Subject = new Subject();
public projectId: string = '';
public idpForm!: FormGroup;
public oidcConfigForm!: FormGroup;
+ public canWrite: Observable = this.authService.isAllowed([this.serviceType === PolicyComponentServiceType.ADMIN ?
+ 'iam.idp.write' : this.serviceType === PolicyComponentServiceType.MGMT ?
+ 'org.idp.write' : '']);
+
constructor(
private toast: ToastService,
private injector: Injector,
private route: ActivatedRoute,
private _location: Location,
+ private authService: GrpcAuthService,
) {
this.idpForm = new FormGroup({
id: new FormControl({ disabled: true, value: '' }, [Validators.required]),
@@ -56,61 +62,75 @@ export class IdpComponent implements OnInit, OnDestroy {
usernameMapping: new FormControl(0),
});
- this.route.data.pipe(switchMap(data => {
- this.serviceType = data.serviceType;
- switch (this.serviceType) {
- case PolicyComponentServiceType.MGMT:
- this.service = this.injector.get(ManagementService as Type);
+ this.route.data.pipe(
+ takeUntil(this.destroy$),
+ switchMap(data => {
+ this.serviceType = data.serviceType;
+ switch (this.serviceType) {
+ case PolicyComponentServiceType.MGMT:
+ this.service = this.injector.get(ManagementService as Type);
- break;
- case PolicyComponentServiceType.ADMIN:
- this.service = this.injector.get(AdminService as Type);
+ break;
+ case PolicyComponentServiceType.ADMIN:
+ this.service = this.injector.get(AdminService as Type);
- break;
- }
-
- this.mappingFields = [
- OIDCMappingField.OIDC_MAPPING_FIELD_PREFERRED_USERNAME,
- OIDCMappingField.OIDC_MAPPING_FIELD_EMAIL];
- this.styleFields = [
- IDPStylingType.STYLING_TYPE_UNSPECIFIED,
- IDPStylingType.STYLING_TYPE_GOOGLE];
-
- return this.route.params.pipe(take(1));
- })).subscribe((params) => {
- const { id } = params;
- if (id) {
- if (this.serviceType === PolicyComponentServiceType.MGMT) {
- (this.service as ManagementService).getOrgIDPByID(id).then(resp => {
- if (resp.idp) {
- const idpObject = resp.idp;
- this.idpForm.patchValue(idpObject);
- if (idpObject.oidcConfig) {
- this.oidcConfigForm.patchValue(idpObject.oidcConfig);
- }
- }
- });
- } else if (this.serviceType === PolicyComponentServiceType.ADMIN) {
- (this.service as AdminService).getIDPByID(id).then(resp => {
- if (resp.idp) {
- const idpObject = resp.idp;
- this.idpForm.patchValue(idpObject);
- if (idpObject.oidcConfig) {
- this.oidcConfigForm.patchValue(idpObject.oidcConfig);
- }
- }
- });
+ break;
}
+
+ this.mappingFields = [
+ OIDCMappingField.OIDC_MAPPING_FIELD_PREFERRED_USERNAME,
+ OIDCMappingField.OIDC_MAPPING_FIELD_EMAIL];
+ this.styleFields = [
+ IDPStylingType.STYLING_TYPE_UNSPECIFIED,
+ IDPStylingType.STYLING_TYPE_GOOGLE];
+
+ return this.route.params.pipe(take(1));
+ })).subscribe((params) => {
+ const { id } = params;
+ if (id) {
+ this.checkWrite();
+
+ if (this.serviceType === PolicyComponentServiceType.MGMT) {
+
+ (this.service as ManagementService).getOrgIDPByID(id).then(resp => {
+ if (resp.idp) {
+ const idpObject = resp.idp;
+ this.idpForm.patchValue(idpObject);
+ if (idpObject.oidcConfig) {
+ this.oidcConfigForm.patchValue(idpObject.oidcConfig);
+ }
+ }
+ });
+ } else if (this.serviceType === PolicyComponentServiceType.ADMIN) {
+ (this.service as AdminService).getIDPByID(id).then(resp => {
+ if (resp.idp) {
+ const idpObject = resp.idp;
+ this.idpForm.patchValue(idpObject);
+ if (idpObject.oidcConfig) {
+ this.oidcConfigForm.patchValue(idpObject.oidcConfig);
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+
+ public checkWrite(): void {
+ this.canWrite.pipe(take(1)).subscribe(canWrite => {
+ if (canWrite) {
+ this.idpForm.enable();
+ this.oidcConfigForm.enable();
+ } else {
+ this.idpForm.disable();
+ this.oidcConfigForm.disable();
}
});
}
- public ngOnInit(): void {
- this.subscription = this.route.params.subscribe(params => this.getData(params));
- }
-
public ngOnDestroy(): void {
- this.subscription?.unsubscribe();
+ this.destroy$.next();
+ this.destroy$.complete();
}
private getData({ projectid }: Params): void {
diff --git a/console/src/app/modules/mfa-table/mfa-table.component.scss b/console/src/app/modules/mfa-table/mfa-table.component.scss
index 015580618f..fda07728bc 100644
--- a/console/src/app/modules/mfa-table/mfa-table.component.scss
+++ b/console/src/app/modules/mfa-table/mfa-table.component.scss
@@ -1,4 +1,3 @@
-
.t .sp_wrapper {
display: block;
}
@@ -22,7 +21,6 @@
justify-content: center;
margin: .5rem;
padding: 10px;
- cursor: pointer;
position: relative;
min-height: 70px;
min-width: 150px;
@@ -43,6 +41,8 @@
}
&:not(.disabled) {
+ cursor: default;
+
&:hover {
.rm {
display: block;
@@ -55,4 +55,8 @@
cursor: not-allowed;
}
}
+
+ .new-mfa:not(.disabled) {
+ cursor: pointer;
+ }
}
diff --git a/console/src/app/modules/policies/login-policy/add-idp-dialog/add-idp-dialog.component.ts b/console/src/app/modules/policies/login-policy/add-idp-dialog/add-idp-dialog.component.ts
index c94a59b2e3..7b7843e8c8 100644
--- a/console/src/app/modules/policies/login-policy/add-idp-dialog/add-idp-dialog.component.ts
+++ b/console/src/app/modules/policies/login-policy/add-idp-dialog/add-idp-dialog.component.ts
@@ -2,80 +2,98 @@ import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { IDP, IDPOwnerType, IDPOwnerTypeQuery } from 'src/app/proto/generated/zitadel/idp_pb';
import { IDPQuery } from 'src/app/proto/generated/zitadel/management_pb';
-import { AdminService } from 'src/app/services/admin.service';
import { ManagementService } from 'src/app/services/mgmt.service';
+import { ToastService } from 'src/app/services/toast.service';
import { PolicyComponentServiceType } from '../../policy-component-types.enum';
@Component({
- selector: 'app-add-idp-dialog',
- templateUrl: './add-idp-dialog.component.html',
- styleUrls: ['./add-idp-dialog.component.scss'],
+ selector: 'app-add-idp-dialog',
+ templateUrl: './add-idp-dialog.component.html',
+ styleUrls: ['./add-idp-dialog.component.scss'],
})
export class AddIdpDialogComponent {
- public PolicyComponentServiceType: any = PolicyComponentServiceType;
- public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT;
+ public PolicyComponentServiceType: any = PolicyComponentServiceType;
+ public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT;
- public idpType!: IDPOwnerType;
- public idpTypes: IDPOwnerType[] = [
- IDPOwnerType.IDP_OWNER_TYPE_SYSTEM,
- IDPOwnerType.IDP_OWNER_TYPE_ORG,
- ];
+ public idpType!: IDPOwnerType;
+ public idpTypes: IDPOwnerType[] = [
+ IDPOwnerType.IDP_OWNER_TYPE_SYSTEM,
+ IDPOwnerType.IDP_OWNER_TYPE_ORG,
+ ];
- public idp: IDP.AsObject | undefined = undefined;
- public availableIdps: Array | string[] = [];
+ public idp: IDP.AsObject | undefined = undefined;
+ public availableIdps: Array | string[] = [];
- constructor(
- private mgmtService: ManagementService,
- private adminService: AdminService,
- public dialogRef: MatDialogRef,
- @Inject(MAT_DIALOG_DATA) public data: any,
- ) {
- if (data.serviceType) {
- this.serviceType = data.serviceType;
- switch (this.serviceType) {
- case PolicyComponentServiceType.MGMT:
- this.idpType = IDPOwnerType.IDP_OWNER_TYPE_ORG;
- break;
- case PolicyComponentServiceType.ADMIN:
- this.idpType = IDPOwnerType.IDP_OWNER_TYPE_SYSTEM;
- break;
- }
- }
-
- this.loadIdps();
+ constructor(
+ private mgmtService: ManagementService,
+ private toast: ToastService,
+ public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: any,
+ ) {
+ if (data.serviceType) {
+ this.serviceType = data.serviceType;
+ switch (this.serviceType) {
+ case PolicyComponentServiceType.MGMT:
+ this.idpType = IDPOwnerType.IDP_OWNER_TYPE_ORG;
+ break;
+ case PolicyComponentServiceType.ADMIN:
+ this.idpType = IDPOwnerType.IDP_OWNER_TYPE_SYSTEM;
+ break;
+ }
}
- public loadIdps(): void {
- this.idp = undefined;
- switch (this.idpType) {
- case IDPOwnerType.IDP_OWNER_TYPE_ORG:
- const query: IDPQuery = new IDPQuery();
- const idpOTQ: IDPOwnerTypeQuery = new IDPOwnerTypeQuery();
- idpOTQ.setOwnerType(this.idpType);
- query.setOwnerTypeQuery(idpOTQ);
+ this.loadIdps();
+ }
- this.mgmtService.listOrgIDPs(undefined, undefined, [query]).then(resp => {
- this.availableIdps = resp.resultList;
- });
- break;
- case IDPOwnerType.IDP_OWNER_TYPE_SYSTEM:
- this.adminService.listIDPs().then(resp => {
- this.availableIdps = resp.resultList;
- });
- break;
+ public loadIdps(): void {
+ this.idp = undefined;
- }
- }
- public closeDialog(): void {
- this.dialogRef.close(false);
- }
- public closeDialogWithSuccess(): void {
- this.dialogRef.close({
- idp: this.idp,
- type: this.idpType,
+ switch (this.idpType) {
+ case IDPOwnerType.IDP_OWNER_TYPE_ORG:
+ const query: IDPQuery = new IDPQuery();
+ const idpOTQ: IDPOwnerTypeQuery = new IDPOwnerTypeQuery();
+ idpOTQ.setOwnerType(this.idpType);
+ query.setOwnerTypeQuery(idpOTQ);
+
+ const orgQuery = new IDPQuery();
+ const orgQ = new IDPOwnerTypeQuery();
+ orgQ.setOwnerType(IDPOwnerType.IDP_OWNER_TYPE_ORG);
+ orgQuery.setOwnerTypeQuery(orgQ);
+ this.mgmtService.listOrgIDPs(undefined, undefined, [orgQuery]).then(resp => {
+ this.availableIdps = resp.resultList;
+ }).catch(error => {
+ this.availableIdps = [];
+ this.toast.showError(error);
});
+ break;
+ case IDPOwnerType.IDP_OWNER_TYPE_SYSTEM:
+ const iamQuery = new IDPQuery();
+ const iamQ = new IDPOwnerTypeQuery();
+ iamQ.setOwnerType(IDPOwnerType.IDP_OWNER_TYPE_SYSTEM);
+ iamQuery.setOwnerTypeQuery(iamQ);
+
+ this.mgmtService.listOrgIDPs(undefined, undefined, [iamQuery]).then(resp => {
+ this.availableIdps = resp.resultList;
+ }).catch(error => {
+ this.availableIdps = [];
+ this.toast.showError(error);
+ });
+ break;
+
}
+ }
+
+ public closeDialog(): void {
+ this.dialogRef.close(false);
+ }
+
+ public closeDialogWithSuccess(): void {
+ this.dialogRef.close({
+ idp: this.idp,
+ type: this.idpType,
+ });
+ }
}
diff --git a/console/src/app/modules/policies/login-policy/login-policy.component.html b/console/src/app/modules/policies/login-policy/login-policy.component.html
index 5b874ea873..2dfcd1d56d 100644
--- a/console/src/app/modules/policies/login-policy/login-policy.component.html
+++ b/console/src/app/modules/policies/login-policy/login-policy.component.html
@@ -177,7 +177,7 @@