mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-19 19:48:45 +00:00
feat(console): JWT IDP, cleanup login policy, update deps (#2438)
* idp cleanup * lint * jwtidp service, create, detail, assets * idp detail, info row * detail actions * delete idp, fix state change * lint * cli core * cdk material * chore(deps-dev): bump karma-jasmine-html-reporter in /console (#2446) Bumps [karma-jasmine-html-reporter](https://github.com/dfederm/karma-jasmine-html-reporter) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/dfederm/karma-jasmine-html-reporter/releases) - [Commits](https://github.com/dfederm/karma-jasmine-html-reporter/compare/v1.6.0...v1.7.0) --- updated-dependencies: - dependency-name: karma-jasmine-html-reporter dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update deps * lock * disable actions, user grant link to user, add granted org desc * lint Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
parent
dbec8e164d
commit
1c20ea5a50
@@ -1,15 +1,12 @@
|
||||
import { Component, Injector, OnDestroy, Type } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { LoginMethodComponentType } from 'src/app/modules/mfa-table/mfa-table.component';
|
||||
import {
|
||||
GetLoginPolicyResponse as AdminGetLoginPolicyResponse,
|
||||
UpdateLoginPolicyRequest,
|
||||
UpdateLoginPolicyResponse,
|
||||
} from 'src/app/proto/generated/zitadel/admin_pb';
|
||||
import { IDP, IDPLoginPolicyLink, IDPOwnerType, IDPStylingType } from 'src/app/proto/generated/zitadel/idp_pb';
|
||||
import {
|
||||
AddCustomLoginPolicyRequest,
|
||||
GetLoginPolicyResponse as MgmtGetLoginPolicyResponse,
|
||||
@@ -21,7 +18,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { GridPolicy, LOGIN_POLICY } from '../../policy-grid/policies';
|
||||
import { PolicyComponentServiceType } from '../policy-component-types.enum';
|
||||
import { AddIdpDialogComponent } from './add-idp-dialog/add-idp-dialog.component';
|
||||
import { LoginMethodComponentType } from './mfa-table/mfa-table.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login-policy',
|
||||
@@ -37,17 +34,14 @@ export class LoginPolicyComponent implements OnDestroy {
|
||||
public service!: ManagementService | AdminService;
|
||||
public PolicyComponentServiceType: any = PolicyComponentServiceType;
|
||||
public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT;
|
||||
public idps: IDPLoginPolicyLink.AsObject[] = [];
|
||||
|
||||
public loading: boolean = false;
|
||||
public disabled: boolean = true;
|
||||
|
||||
public IDPStylingType: any = IDPStylingType;
|
||||
public currentPolicy: GridPolicy = LOGIN_POLICY;
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private dialog: MatDialog,
|
||||
private injector: Injector,
|
||||
) {
|
||||
this.sub = this.route.data.pipe(switchMap(data => {
|
||||
@@ -83,9 +77,7 @@ export class LoginPolicyComponent implements OnDestroy {
|
||||
this.disabled = this.isDefault;
|
||||
}
|
||||
});
|
||||
this.getIdps().then(resp => {
|
||||
this.idps = resp;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
@@ -102,21 +94,6 @@ export class LoginPolicyComponent implements OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
private async getIdps(): Promise<IDPLoginPolicyLink.AsObject[]> {
|
||||
switch (this.serviceType) {
|
||||
case PolicyComponentServiceType.MGMT:
|
||||
return (this.service as ManagementService).listLoginPolicyIDPs()
|
||||
.then((resp) => {
|
||||
return resp.resultList;
|
||||
});
|
||||
case PolicyComponentServiceType.ADMIN:
|
||||
return (this.service as AdminService).listLoginPolicyIDPs()
|
||||
.then((providers) => {
|
||||
return providers.resultList;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private async updateData():
|
||||
Promise<UpdateLoginPolicyResponse.AsObject> {
|
||||
switch (this.serviceType) {
|
||||
@@ -172,62 +149,6 @@ export class LoginPolicyComponent implements OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
public openDialog(): void {
|
||||
const dialogRef = this.dialog.open(AddIdpDialogComponent, {
|
||||
data: {
|
||||
serviceType: this.serviceType,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp && resp.idp && resp.type) {
|
||||
this.addIdp(resp.idp, resp.type).then(() => {
|
||||
this.loading = true;
|
||||
setTimeout(() => {
|
||||
this.fetchData();
|
||||
}, 2000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private addIdp(idp: IDP.AsObject | IDP.AsObject, ownerType: IDPOwnerType): Promise<any> {
|
||||
switch (this.serviceType) {
|
||||
case PolicyComponentServiceType.MGMT:
|
||||
return (this.service as ManagementService).addIDPToLoginPolicy(idp.id, ownerType);
|
||||
case PolicyComponentServiceType.ADMIN:
|
||||
return (this.service as AdminService).addIDPToLoginPolicy(idp.id);
|
||||
}
|
||||
}
|
||||
|
||||
public removeIdp(idp: IDPLoginPolicyLink.AsObject): void {
|
||||
switch (this.serviceType) {
|
||||
case PolicyComponentServiceType.MGMT:
|
||||
(this.service as ManagementService).removeIDPFromLoginPolicy(idp.idpId).then(() => {
|
||||
const index = this.idps.findIndex(temp => temp === idp);
|
||||
if (index > -1) {
|
||||
this.idps.splice(index, 1);
|
||||
}
|
||||
}, error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
break;
|
||||
case PolicyComponentServiceType.ADMIN:
|
||||
(this.service as AdminService).removeIDPFromLoginPolicy(idp.idpId).then(() => {
|
||||
const index = this.idps.findIndex(temp => temp === idp);
|
||||
if (index > -1) {
|
||||
this.idps.splice(index, 1);
|
||||
}
|
||||
}, error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public get isDefault(): boolean {
|
||||
if (this.loginData && this.serviceType === PolicyComponentServiceType.MGMT) {
|
||||
return (this.loginData as LoginPolicy.AsObject).isDefault;
|
||||
|
||||
Reference in New Issue
Block a user