mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-26 22:38:45 +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
@@ -6,9 +6,28 @@
|
||||
<div class="title-row">
|
||||
<mat-icon class="idp-logo" svgIcon="mdi_jwt" alt="jwt" />
|
||||
<h1>{{ 'IDP.CREATE.JWT.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
|
||||
[configureProvider]="(exists$ | async) === false"
|
||||
[configureTitle]="'DESCRIPTIONS.SETTINGS.IDPS.JWT.TITLE' | translate"
|
||||
[configureDescription]="'DESCRIPTIONS.SETTINGS.IDPS.JWT.DESCRIPTION' | translate"
|
||||
configureLink="https://zitadel.com/docs/guides/integrate/identity-providers/jwt-idp"
|
||||
[autofillLink]="autofillLink$ | async"
|
||||
[activateLink]="activateLink$ | async"
|
||||
[expanded]="!!(expandWhatNow$ | async)"
|
||||
(activate)="activate()"
|
||||
></cnsl-provider-next>
|
||||
|
||||
<p class="identity-provider-desc cnsl-secondary-text">{{ 'IDP.CREATE.JWT.DESCRIPTION' | translate }}</p>
|
||||
|
||||
<form [formGroup]="form" (ngSubmit)="submitForm()">
|
||||
@@ -57,8 +76,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>
|
||||
|
||||
@@ -23,6 +23,8 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { requiredValidator } from '../../form-field/validators/validators';
|
||||
|
||||
import { PolicyComponentServiceType } from '../../policies/policy-component-types.enum';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { ProviderNextService } from '../provider-next/provider-next.service';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-provider-jwt',
|
||||
@@ -32,8 +34,11 @@ export class ProviderJWTComponent {
|
||||
public showOptional: boolean = false;
|
||||
public options: Options = new Options().setIsCreationAllowed(true).setIsLinkingAllowed(true);
|
||||
|
||||
// DEPRECATED: use id$ instead
|
||||
public id: string | null = '';
|
||||
// DEPRECATED: assert service$ instead
|
||||
public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT;
|
||||
// DEPRECATED: use service$ instead
|
||||
private service!: ManagementService | AdminService;
|
||||
public readonly separatorKeysCodes: number[] = [ENTER, COMMA, SPACE];
|
||||
|
||||
@@ -42,6 +47,24 @@ export class ProviderJWTComponent {
|
||||
|
||||
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,
|
||||
@@ -49,6 +72,7 @@ export class ProviderJWTComponent {
|
||||
private injector: Injector,
|
||||
private _location: Location,
|
||||
breadcrumbService: BreadcrumbService,
|
||||
private nextSvc: ProviderNextService,
|
||||
) {
|
||||
this.route.data.pipe(take(1)).subscribe((data) => {
|
||||
this.serviceType = data['serviceType'];
|
||||
@@ -108,6 +132,10 @@ export class ProviderJWTComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public activate() {
|
||||
this.nextSvc.activate(this.id$, this.justActivated$, this.service$);
|
||||
}
|
||||
|
||||
private getData(id: string): void {
|
||||
const req =
|
||||
this.serviceType === PolicyComponentServiceType.ADMIN
|
||||
@@ -131,7 +159,7 @@ export class ProviderJWTComponent {
|
||||
}
|
||||
|
||||
public submitForm(): void {
|
||||
this.provider ? this.updateJWTProvider() : this.addJWTProvider();
|
||||
this.provider || this.justCreated$.value ? this.updateJWTProvider() : this.addJWTProvider();
|
||||
}
|
||||
|
||||
public addJWTProvider(): void {
|
||||
@@ -149,11 +177,9 @@ export class ProviderJWTComponent {
|
||||
this.loading = true;
|
||||
this.service
|
||||
.addJWTProvider(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);
|
||||
@@ -162,12 +188,12 @@ export class ProviderJWTComponent {
|
||||
}
|
||||
|
||||
public updateJWTProvider(): void {
|
||||
if (this.provider) {
|
||||
if (this.provider || this.justCreated$.value) {
|
||||
const req =
|
||||
this.serviceType === PolicyComponentServiceType.MGMT
|
||||
? new MgmtUpdateJWTProviderRequest()
|
||||
: new AdminUpdateJWTProviderRequest();
|
||||
req.setId(this.provider.id);
|
||||
req.setId(this.provider?.id || this.justCreated$.value);
|
||||
req.setName(this.name?.value);
|
||||
req.setHeaderName(this.headerName?.value);
|
||||
req.setIssuer(this.issuer?.value);
|
||||
|
||||
Reference in New Issue
Block a user