mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-27 06:38:46 +00:00
feat(console): guide users when configuring IDPs (#7572)
* feat(console): show external idp remote config * reuse copy-row * finish google and saml sp * finish apps * add next steps modal * rollout * activate * fix saml urls * fix saml provider * complete providers * translate * update google docs * update entra id oidc docs * update entra id saml docs * update github docs * update gitlab docs * update apple docs * update okta oidc docs * update okta saml docs * update keycloak docs * update mocksaml * cleanup * lint * lint * fix overriden classes * encapsulate styles * fix icon classes --------- Co-authored-by: peintnermax <[email protected]>
This commit is contained in:
co-authored by
peintnermax
parent
84644214d7
commit
d26391a642
@@ -5,11 +5,25 @@
|
||||
<div class="identity-provider-create-content">
|
||||
<div class="title-row">
|
||||
<img class="idp-logo" src="./assets/images/idp/oauth.svg" alt="oauth" />
|
||||
|
||||
<h1>{{ 'IDP.CREATE.OAUTH.TITLE' | translate }}</h1>
|
||||
<ng-container *ngIf="exists$ | async">
|
||||
<div
|
||||
*ngIf="{ isNotActive: (activateLink$ | async) } as idp"
|
||||
class="cnsl-state-dot"
|
||||
[matTooltip]="(idp.isNotActive ? 'IDP.STATES.2' : 'IDP.STATES.1') | translate"
|
||||
[ngClass]="{ active: !idp.isNotActive, inactive: !!idp.isNotActive }"
|
||||
></div>
|
||||
</ng-container>
|
||||
<mat-spinner diameter="25" *ngIf="loading" color="primary"></mat-spinner>
|
||||
</div>
|
||||
|
||||
<cnsl-provider-next
|
||||
[autofillLink]="autofillLink$ | async"
|
||||
[activateLink]="activateLink$ | async"
|
||||
[expanded]="!!(expandWhatNow$ | async)"
|
||||
(activate)="activate()"
|
||||
></cnsl-provider-next>
|
||||
|
||||
<p class="identity-provider-desc cnsl-secondary-text">{{ 'IDP.CREATE.OAUTH.DESCRIPTION' | translate }}</p>
|
||||
|
||||
<form [formGroup]="form" (ngSubmit)="submitForm()">
|
||||
@@ -107,8 +121,9 @@
|
||||
[disabled]="form.invalid || form.disabled"
|
||||
type="submit"
|
||||
>
|
||||
<span *ngIf="id">{{ 'ACTIONS.SAVE' | translate }}</span>
|
||||
<span *ngIf="!id">{{ 'ACTIONS.CREATE' | translate }}</span>
|
||||
<span *ngIf="{ exists: (exists$ | async) } as idp">{{
|
||||
(!!idp.exists ? 'ACTIONS.SAVE' : 'ACTIONS.CREATE') | translate
|
||||
}}</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Component, Injector, Type } from '@angular/core';
|
||||
import { AbstractControl, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatChipInputEvent } from '@angular/material/chips';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { take } from 'rxjs';
|
||||
import { BehaviorSubject, take } from 'rxjs';
|
||||
import {
|
||||
AddGenericOAuthProviderRequest as AdminAddGenericOAuthProviderRequest,
|
||||
GetProviderByIDRequest as AdminGetProviderByIDRequest,
|
||||
@@ -24,6 +24,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { requiredValidator } from '../../form-field/validators/validators';
|
||||
|
||||
import { PolicyComponentServiceType } from '../../policies/policy-component-types.enum';
|
||||
import { ProviderNextService } from '../provider-next/provider-next.service';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-provider-oauth',
|
||||
@@ -33,9 +34,12 @@ export class ProviderOAuthComponent {
|
||||
public showOptional: boolean = false;
|
||||
public options: Options = new Options().setIsCreationAllowed(true).setIsLinkingAllowed(true);
|
||||
|
||||
// DEPRECATED: use id$ instead
|
||||
public id: string | null = '';
|
||||
public updateClientSecret: boolean = false;
|
||||
// DEPRECATED: assert service$ instead
|
||||
public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT;
|
||||
// DEPRECATED: use service$ instead
|
||||
private service!: ManagementService | AdminService;
|
||||
public readonly separatorKeysCodes: number[] = [ENTER, COMMA, SPACE];
|
||||
public form!: UntypedFormGroup;
|
||||
@@ -44,6 +48,24 @@ export class ProviderOAuthComponent {
|
||||
|
||||
public provider?: Provider.AsObject;
|
||||
|
||||
public justCreated$: BehaviorSubject<string> = new BehaviorSubject<string>('');
|
||||
public justActivated$ = new BehaviorSubject<boolean>(false);
|
||||
|
||||
private service$ = this.nextSvc.service(this.route.data);
|
||||
private id$ = this.nextSvc.id(this.route.paramMap, this.justCreated$);
|
||||
public exists$ = this.nextSvc.exists(this.id$);
|
||||
public autofillLink$ = this.nextSvc.autofillLink(
|
||||
this.id$,
|
||||
`https://zitadel.com/docs/guides/integrate/identity-providers/additional-information`,
|
||||
);
|
||||
public activateLink$ = this.nextSvc.activateLink(
|
||||
this.id$,
|
||||
this.justActivated$,
|
||||
'https://zitadel.com/docs/guides/integrate/identity-providers/okta-oidc#activate-idp',
|
||||
this.service$,
|
||||
);
|
||||
public expandWhatNow$ = this.nextSvc.expandWhatNow(this.id$, this.activateLink$, this.justCreated$);
|
||||
|
||||
constructor(
|
||||
private authService: GrpcAuthService,
|
||||
private route: ActivatedRoute,
|
||||
@@ -51,6 +73,7 @@ export class ProviderOAuthComponent {
|
||||
private injector: Injector,
|
||||
private _location: Location,
|
||||
breadcrumbService: BreadcrumbService,
|
||||
private nextSvc: ProviderNextService,
|
||||
) {
|
||||
this.form = new UntypedFormGroup({
|
||||
name: new UntypedFormControl('', [requiredValidator]),
|
||||
@@ -114,6 +137,10 @@ export class ProviderOAuthComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public activate() {
|
||||
this.nextSvc.activate(this.id$, this.justActivated$, this.service$);
|
||||
}
|
||||
|
||||
private getData(id: string): void {
|
||||
this.loading = true;
|
||||
const req =
|
||||
@@ -138,7 +165,7 @@ export class ProviderOAuthComponent {
|
||||
}
|
||||
|
||||
public submitForm(): void {
|
||||
this.provider ? this.updateGenericOAuthProvider() : this.addGenericOAuthProvider();
|
||||
this.provider || this.justCreated$.value ? this.updateGenericOAuthProvider() : this.addGenericOAuthProvider();
|
||||
}
|
||||
|
||||
public addGenericOAuthProvider(): void {
|
||||
@@ -160,11 +187,9 @@ export class ProviderOAuthComponent {
|
||||
this.loading = true;
|
||||
this.service
|
||||
.addGenericOAuthProvider(req)
|
||||
.then((idp) => {
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
this.close();
|
||||
}, 2000);
|
||||
.then((addedIDP) => {
|
||||
this.justCreated$.next(addedIDP.id);
|
||||
this.loading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
@@ -173,12 +198,12 @@ export class ProviderOAuthComponent {
|
||||
}
|
||||
|
||||
public updateGenericOAuthProvider(): void {
|
||||
if (this.provider) {
|
||||
if (this.provider || this.justCreated$.value) {
|
||||
const req =
|
||||
this.serviceType === PolicyComponentServiceType.MGMT
|
||||
? new MgmtUpdateGenericOAuthProviderRequest()
|
||||
: new AdminUpdateGenericOAuthProviderRequest();
|
||||
req.setId(this.provider.id);
|
||||
req.setId(this.provider?.id || this.justCreated$.value);
|
||||
req.setName(this.name?.value);
|
||||
req.setAuthorizationEndpoint(this.authorizationEndpoint?.value);
|
||||
req.setIdAttribute(this.idAttribute?.value);
|
||||
|
||||
Reference in New Issue
Block a user