mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-24 21:48: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
@@ -7,7 +7,7 @@ import { ManagementService } from '../../../services/mgmt.service';
|
||||
import { AdminService } from '../../../services/admin.service';
|
||||
import { ToastService } from '../../../services/toast.service';
|
||||
import { GrpcAuthService } from '../../../services/grpc-auth.service';
|
||||
import { take } from 'rxjs';
|
||||
import { BehaviorSubject, shareReplay, switchMap, take } from 'rxjs';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from '../../../services/breadcrumb.service';
|
||||
import { atLeastOneIsFilled, requiredValidator } from '../../form-field/validators/validators';
|
||||
@@ -21,6 +21,9 @@ import {
|
||||
GetProviderByIDRequest as MgmtGetProviderByIDRequest,
|
||||
UpdateSAMLProviderRequest as MgmtUpdateSAMLProviderRequest,
|
||||
} from 'src/app/proto/generated/zitadel/management_pb';
|
||||
import { Environment, EnvironmentService } from '../../../services/environment.service';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { ProviderNextService } from '../provider-next/provider-next.service';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-provider-saml-sp',
|
||||
@@ -28,17 +31,67 @@ import {
|
||||
styleUrls: ['./provider-saml-sp.component.scss'],
|
||||
})
|
||||
export class ProviderSamlSpComponent {
|
||||
// DEPRECATED: use id$ instead
|
||||
public id: string | null = '';
|
||||
public loading: boolean = false;
|
||||
public provider?: Provider.AsObject;
|
||||
public form!: FormGroup;
|
||||
public showOptional: boolean = false;
|
||||
public options: Options = new Options().setIsCreationAllowed(true).setIsLinkingAllowed(true);
|
||||
// DEPRECATED: assert service$ instead
|
||||
public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT;
|
||||
// DEPRECATED: use service$ instead
|
||||
private service!: ManagementService | AdminService;
|
||||
|
||||
bindingValues: string[] = Object.keys(SAMLBinding);
|
||||
|
||||
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/mocksaml#optional-add-zitadel-action-to-autofill-userdata`,
|
||||
);
|
||||
public activateLink$ = this.nextSvc.activateLink(
|
||||
this.id$,
|
||||
this.justActivated$,
|
||||
'https://zitadel.com/docs/guides/integrate/identity-providers/mocksaml#activate-idp',
|
||||
this.service$,
|
||||
);
|
||||
public expandWhatNow$ = this.nextSvc.expandWhatNow(this.id$, this.activateLink$, this.justCreated$);
|
||||
public copyUrls$ = this.id$.pipe(
|
||||
filter((id) => !!id),
|
||||
switchMap((id) =>
|
||||
this.envSvc.env.pipe(
|
||||
map((environment: Environment) => {
|
||||
const idpBase = `${environment.issuer}/idps/${id}/saml`;
|
||||
return [
|
||||
{
|
||||
label: 'ZITADEL Metadata',
|
||||
url: `${idpBase}/metadata`,
|
||||
downloadable: true,
|
||||
},
|
||||
{
|
||||
label: 'ZITADEL ACS Login Form',
|
||||
url: `${environment.issuer}/ui/login/login/externalidp/saml/acs`,
|
||||
},
|
||||
{
|
||||
label: 'ZITADEL ACS Intent API',
|
||||
url: `${idpBase}/acs`,
|
||||
},
|
||||
{
|
||||
label: 'ZITADEL Single Logout',
|
||||
url: `${idpBase}/slo`,
|
||||
},
|
||||
];
|
||||
}),
|
||||
),
|
||||
),
|
||||
shareReplay(1),
|
||||
);
|
||||
|
||||
constructor(
|
||||
private _location: Location,
|
||||
private toast: ToastService,
|
||||
@@ -46,6 +99,8 @@ export class ProviderSamlSpComponent {
|
||||
private route: ActivatedRoute,
|
||||
private injector: Injector,
|
||||
private breadcrumbService: BreadcrumbService,
|
||||
private envSvc: EnvironmentService,
|
||||
private nextSvc: ProviderNextService,
|
||||
) {
|
||||
this._buildBreadcrumbs();
|
||||
this._initializeForm();
|
||||
@@ -117,14 +172,18 @@ export class ProviderSamlSpComponent {
|
||||
});
|
||||
}
|
||||
|
||||
public activate() {
|
||||
this.nextSvc.activate(this.id$, this.justActivated$, this.service$);
|
||||
}
|
||||
|
||||
public updateSAMLProvider(): void {
|
||||
if (this.provider) {
|
||||
if (this.provider || this.justCreated$.value) {
|
||||
const req =
|
||||
this.serviceType === PolicyComponentServiceType.MGMT
|
||||
? new MgmtUpdateSAMLProviderRequest()
|
||||
: new AdminUpdateSAMLProviderRequest();
|
||||
|
||||
req.setId(this.provider.id);
|
||||
req.setId(this.provider?.id || this.justCreated$.value);
|
||||
req.setName(this.name?.value);
|
||||
if (this.metadataXml?.value) {
|
||||
req.setMetadataXml(this.metadataXml?.value);
|
||||
@@ -170,11 +229,9 @@ export class ProviderSamlSpComponent {
|
||||
this.loading = true;
|
||||
this.service
|
||||
.addSAMLProvider(req)
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
this.close();
|
||||
}, 2000);
|
||||
.then((addedIDP) => {
|
||||
this.justCreated$.next(addedIDP.id);
|
||||
this.loading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
@@ -183,7 +240,7 @@ export class ProviderSamlSpComponent {
|
||||
}
|
||||
|
||||
public submitForm(): void {
|
||||
this.provider ? this.updateSAMLProvider() : this.addSAMLProvider();
|
||||
this.provider || this.justCreated$.value ? this.updateSAMLProvider() : this.addSAMLProvider();
|
||||
}
|
||||
|
||||
private getData(id: string): void {
|
||||
|
||||
Reference in New Issue
Block a user