chore!: Introduce ZITADEL v3 (#9645)

This PR summarizes multiple changes specifically only available with
ZITADEL v3:

- feat: Web Keys management
(https://github.com/zitadel/zitadel/pull/9526)
- fix(cmd): ensure proper working of mirror
(https://github.com/zitadel/zitadel/pull/9509)
- feat(Authz): system user support for permission check v2
(https://github.com/zitadel/zitadel/pull/9640)
- chore(license): change from Apache to AGPL
(https://github.com/zitadel/zitadel/pull/9597)
- feat(console): list v2 sessions
(https://github.com/zitadel/zitadel/pull/9539)
- fix(console): add loginV2 feature flag
(https://github.com/zitadel/zitadel/pull/9682)
- fix(feature flags): allow reading "own" flags
(https://github.com/zitadel/zitadel/pull/9649)
- feat(console): add Actions V2 UI
(https://github.com/zitadel/zitadel/pull/9591)

BREAKING CHANGE
- feat(webkey): migrate to v2beta API
(https://github.com/zitadel/zitadel/pull/9445)
- chore!: remove CockroachDB Support
(https://github.com/zitadel/zitadel/pull/9444)
- feat(actions): migrate to v2beta API
(https://github.com/zitadel/zitadel/pull/9489)

---------

Co-authored-by: Livio Spring <[email protected]>
Co-authored-by: Stefan Benz <[email protected]>
Co-authored-by: Silvan <[email protected]>
Co-authored-by: Ramon <[email protected]>
Co-authored-by: Elio Bischof <[email protected]>
Co-authored-by: Kenta Yamaguchi <[email protected]>
Co-authored-by: Harsha Reddy <[email protected]>
Co-authored-by: Livio Spring <[email protected]>
Co-authored-by: Max Peintner <[email protected]>
Co-authored-by: Iraq <[email protected]>
Co-authored-by: Florian Forster <[email protected]>
Co-authored-by: Tim Möhlmann <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Max Peintner <[email protected]>
This commit is contained in:
Fabienne Bühler
2025-04-02 16:53:06 +02:00
committed by GitHub
co-authored by Livio Spring Stefan Benz Silvan Ramon Elio Bischof Kenta Yamaguchi Harsha Reddy Livio Spring Max Peintner Iraq Florian Forster Tim Möhlmann Copilot Max Peintner
parent d14a23ae7e
commit 07ce3b6905
559 changed files with 14578 additions and 7622 deletions
@@ -21,6 +21,11 @@
{{ 'USER.LOGINMETHODS.EMAIL.ISVERIFIED' | translate }}
</mat-checkbox>
</div>
<cnsl-form-field class="username">
<cnsl-label>{{ 'USER.PROFILE.USERNAME' | translate }}</cnsl-label>
<input class="stretchInput" cnslInput formControlName="username" required />
</cnsl-form-field>
<cnsl-form-field class="givenName">
<cnsl-label>{{ 'USER.PROFILE.FIRSTNAME' | translate }}</cnsl-label>
<input cnslInput formControlName="givenName" required />
@@ -29,14 +34,6 @@
<cnsl-label>{{ 'USER.PROFILE.LASTNAME' | translate }}</cnsl-label>
<input cnslInput formControlName="familyName" required />
</cnsl-form-field>
<cnsl-form-field class="nickName">
<cnsl-label>{{ 'USER.PROFILE.NICKNAME' | translate }}</cnsl-label>
<input cnslInput formControlName="nickName" />
</cnsl-form-field>
<cnsl-form-field class="username">
<cnsl-label>{{ 'USER.PROFILE.USERNAME' | translate }}</cnsl-label>
<input cnslInput formControlName="username" required />
</cnsl-form-field>
<div class="authenticationFactor">
<mat-radio-group
@@ -13,8 +13,8 @@
grid-template-areas:
'email email'
'emailVerified emailVerified'
'username username'
'givenName familyName'
'nickName username'
'authenticationFactor authenticationFactor';
column-gap: 1rem;
}
@@ -35,10 +35,6 @@
grid-area: familyName;
}
.nickName {
grid-area: nickName;
}
.username {
grid-area: username;
}
@@ -97,7 +97,6 @@ export class UserCreateV2Component implements OnInit {
username: new FormControl('', { nonNullable: true, validators: [requiredValidator, minLengthValidator(2)] }),
givenName: new FormControl('', { nonNullable: true, validators: [requiredValidator] }),
familyName: new FormControl('', { nonNullable: true, validators: [requiredValidator] }),
nickName: new FormControl('', { nonNullable: true }),
emailVerified: new FormControl(false, { nonNullable: true }),
authenticationFactor: new FormControl<AuthenticationFactor['factor']>(authenticationFactor, {
nonNullable: true,
@@ -188,7 +187,6 @@ export class UserCreateV2Component implements OnInit {
profile: {
givenName: userValues.givenName,
familyName: userValues.familyName,
nickName: userValues.nickName,
},
email: {
email: userValues.email,
@@ -11,12 +11,7 @@
>
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table
[hideRefresh]="true"
[loading]="loading$ | async"
(refreshed)="getPasswordless()"
[dataSize]="dataSource.data.length"
>
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" (refreshed)="getPasswordless()">
<button
actions
class="button"
@@ -24,13 +24,11 @@
<div class="max-width-container">
<cnsl-meta-layout *ngIf="user(userQuery) as user">
<cnsl-sidenav
*ngIf="currentSetting$ | async as currentSetting"
[ngModel]="currentSetting"
(ngModelChange)="goToSetting($event)"
[setting]="currentSetting$()"
(settingChange)="currentSetting$.set($event)"
[settingsList]="settingsList"
queryParam="id"
>
<ng-container *ngIf="currentSetting === 'general' && humanUser(userQuery) as humanUser">
<ng-container *ngIf="currentSetting$().id === 'general' && humanUser(userQuery) as humanUser">
<cnsl-card
*ngIf="humanUser.type.value.profile as profile"
class="app-card"
@@ -91,11 +89,11 @@
</ng-template>
</ng-container>
<ng-container *ngIf="currentSetting === 'idp'">
<ng-container *ngIf="currentSetting$().id === 'idp'">
<cnsl-external-idps [userId]="user.userId" [service]="grpcAuthService"></cnsl-external-idps>
</ng-container>
<ng-container *ngIf="currentSetting === 'security'">
<ng-container *ngIf="currentSetting$().id === 'security'">
<cnsl-card *ngIf="humanUser(userQuery) as humanUser" title="{{ 'USER.PASSWORD.TITLE' | translate }}">
<div class="contact-method-col">
<div class="contact-method-row">
@@ -127,7 +125,7 @@
></cnsl-auth-user-mfa>
</ng-container>
<ng-container *ngIf="currentSetting === 'grants'">
<ng-container *ngIf="currentSetting$().id === 'grants'">
<cnsl-card title="{{ 'GRANTS.USER.TITLE' | translate }}" description="{{ 'GRANTS.USER.DESCRIPTION' | translate }}">
<cnsl-user-grants
[userId]="user.userId"
@@ -149,7 +147,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'memberships'">
<ng-container *ngIf="currentSetting$().id === 'memberships'">
<cnsl-card
title="{{ 'USER.MEMBERSHIPS.TITLE' | translate }}"
description="{{ 'USER.MEMBERSHIPS.DESCRIPTION' | translate }}"
@@ -158,7 +156,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'metadata' && (metadata$ | async) as metadataQuery">
<ng-container *ngIf="currentSetting$().id === 'metadata' && (metadata$ | async) as metadataQuery">
<cnsl-metadata
*ngIf="metadataQuery.state !== 'error'"
[metadata]="metadataQuery.value"
@@ -1,11 +1,11 @@
import { MediaMatcher } from '@angular/cdk/layout';
import { Component, DestroyRef, EventEmitter, OnInit } from '@angular/core';
import { Component, DestroyRef, EventEmitter, OnInit, signal } from '@angular/core';
import { Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Buffer } from 'buffer';
import { defer, EMPTY, fromEvent, mergeWith, Observable, of, shareReplay, Subject, switchMap, take } from 'rxjs';
import { defer, EMPTY, mergeWith, Observable, of, shareReplay, Subject, switchMap, take } from 'rxjs';
import { ChangeType } from 'src/app/modules/changes/changes.component';
import { phoneValidator, requiredValidator } from 'src/app/modules/form-field/validators/validators';
import { InfoDialogComponent } from 'src/app/modules/info-dialog/info-dialog.component';
@@ -25,7 +25,7 @@ import { formatPhone } from 'src/app/utils/formatPhone';
import { EditDialogComponent, EditDialogData, EditDialogResult, EditDialogType } from './edit-dialog/edit-dialog.component';
import { LanguagesService } from 'src/app/services/languages.service';
import { Gender, HumanProfile, HumanUser, User, UserState } from '@zitadel/proto/zitadel/user/v2/user_pb';
import { catchError, filter, map, startWith, withLatestFrom } from 'rxjs/operators';
import { catchError, filter, map, startWith } from 'rxjs/operators';
import { pairwiseStartWith } from 'src/app/utils/pairwiseStartWith';
import { NewAuthService } from 'src/app/services/new-auth.service';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -75,7 +75,7 @@ export class AuthUserDetailComponent implements OnInit {
protected readonly user$: Observable<UserQuery>;
protected readonly metadata$: Observable<MetadataQuery>;
private readonly savedLanguage$: Observable<string>;
protected readonly currentSetting$: Observable<string | undefined>;
protected readonly currentSetting$ = signal<SidenavSetting>(this.settingsList[0]);
protected readonly loginPolicy$: Observable<LoginPolicy>;
protected readonly userName$: Observable<string>;
@@ -86,7 +86,6 @@ export class AuthUserDetailComponent implements OnInit {
private dialog: MatDialog,
private auth: AuthenticationService,
private breadcrumbService: BreadcrumbService,
private mediaMatcher: MediaMatcher,
public langSvc: LanguagesService,
private readonly route: ActivatedRoute,
private readonly newAuthService: NewAuthService,
@@ -95,7 +94,6 @@ export class AuthUserDetailComponent implements OnInit {
private readonly destroyRef: DestroyRef,
private readonly router: Router,
) {
this.currentSetting$ = this.getCurrentSetting$().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.user$ = this.getUser$().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.userName$ = this.getUserName(this.user$);
this.savedLanguage$ = this.getSavedLanguage$(this.user$);
@@ -150,6 +148,7 @@ export class AuthUserDetailComponent implements OnInit {
]);
}
});
this.user$.pipe(mergeWith(this.metadata$), takeUntilDestroyed(this.destroyRef)).subscribe((query) => {
if (query.state == 'error') {
this.toast.showError(query.error);
@@ -159,22 +158,16 @@ export class AuthUserDetailComponent implements OnInit {
this.savedLanguage$
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((savedLanguage) => this.translate.use(savedLanguage));
}
private getCurrentSetting$(): Observable<string | undefined> {
const mediaq: string = '(max-width: 500px)';
const matcher = this.mediaMatcher.matchMedia(mediaq);
const small$ = fromEvent(matcher, 'change', ({ matches }: MediaQueryListEvent) => matches).pipe(
startWith(matcher.matches),
);
return this.route.queryParamMap.pipe(
map((params) => params.get('id')),
filter(Boolean),
startWith('general'),
withLatestFrom(small$),
map(([id, small]) => (small ? undefined : id)),
);
const param = this.route.snapshot.queryParamMap.get('id');
if (!param) {
return;
}
const setting = this.settingsList.find(({ id }) => id === param);
if (!setting) {
return;
}
this.currentSetting$.set(setting);
}
private getUser$(): Observable<UserQuery> {
@@ -9,12 +9,7 @@
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table
[hideRefresh]="true"
[loading]="loading$ | async"
(refreshed)="getMFAs()"
[dataSize]="dataSource.data.length"
>
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" (refreshed)="getMFAs()">
<button
actions
class="button"
@@ -8,13 +8,7 @@
>
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table
[hideRefresh]="true"
[loading]="loading$ | async"
[dataSize]="dataSource.data.length"
[timestamp]="viewTimestamp"
[selection]="selection"
>
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" [timestamp]="viewTimestamp" [selection]="selection">
<div class="table-wrapper">
<table class="table" mat-table [dataSource]="dataSource">
<ng-container matColumnDef="select">
@@ -11,7 +11,7 @@
>
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" [dataSize]="dataSource.data.length">
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async">
<button
actions
[disabled]="disabled"
@@ -52,10 +52,9 @@
<cnsl-meta-layout>
<cnsl-sidenav
*ngIf="settingsList$ | async as settingsList"
[ngModel]="currentSetting$ | async"
(ngModelChange)="goToSetting($event)"
[setting]="currentSetting$()"
(settingChange)="currentSetting$.set($event)"
[settingsList]="settingsList"
queryParam="id"
>
<div class="max-width-container">
<cnsl-info-section class="locked" *ngIf="user?.state === UserState.LOCKED" [type]="InfoSectionType.WARN">
@@ -72,7 +71,7 @@
</cnsl-info-section>
</div>
<ng-container *ngIf="(currentSetting$ | async) === 'general'">
<ng-container *ngIf="currentSetting$().id === 'general'">
<ng-template
*ngIf="humanUser(user) as user"
cnslHasRole
@@ -141,13 +140,13 @@
</ng-container>
<cnsl-external-idps
*ngIf="(currentSetting$ | async) === 'idp' && user.type.case === 'human' && user.userId"
*ngIf="currentSetting$().id === 'idp' && user.type.case === 'human' && user.userId"
[userId]="user.userId"
[service]="mgmtService"
/>
<cnsl-card
*ngIf="(currentSetting$ | async) === 'general' && user.type.case === 'machine'"
*ngIf="currentSetting$().id === 'general' && user.type.case === 'machine'"
title="{{ 'USER.MACHINE.TITLE' | translate }}"
>
<cnsl-detail-form-machine
@@ -158,7 +157,7 @@
/>
</cnsl-card>
<ng-container *ngIf="(currentSetting$ | async) === 'pat'">
<ng-container *ngIf="currentSetting$().id === 'pat'">
<ng-template cnslHasRole [hasRole]="['user.read$', 'user.read:' + user.userId]">
<cnsl-card
*ngIf="user.type.case === 'machine' && user.userId"
@@ -170,7 +169,7 @@
</ng-template>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'keys'">
<ng-container *ngIf="currentSetting$().id === 'keys'">
<ng-template cnslHasRole [hasRole]="['user.read$', 'user.read:' + user.userId]">
<cnsl-card
*ngIf="user.type.case === 'machine' && user.userId"
@@ -182,7 +181,7 @@
</ng-template>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'security'">
<ng-container *ngIf="currentSetting$().id === 'security'">
<cnsl-card *ngIf="user.type.case === 'human'" title="{{ 'USER.PASSWORD.TITLE' | translate }}">
<div class="contact-method-col">
<div class="contact-method-row">
@@ -214,7 +213,7 @@
<cnsl-user-mfa *ngIf="user.type.case === 'human'" [user]="user"></cnsl-user-mfa>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'grants'">
<ng-container *ngIf="currentSetting$().id === 'grants'">
<cnsl-card
*ngIf="user.userId"
title="{{ 'GRANTS.USER.TITLE' | translate }}"
@@ -239,7 +238,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'memberships'">
<ng-container *ngIf="currentSetting$().id === 'memberships'">
<cnsl-card
*ngIf="user.userId"
title="{{ 'USER.MEMBERSHIPS.TITLE' | translate }}"
@@ -249,7 +248,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'metadata' && (metadata$ | async) as metadataQuery">
<ng-container *ngIf="currentSetting$().id === 'metadata' && (metadata$ | async) as metadataQuery">
<cnsl-metadata
*ngIf="user.userId && metadataQuery.state !== 'error'"
[metadata]="metadataQuery.value"
@@ -1,12 +1,11 @@
import { MediaMatcher } from '@angular/cdk/layout';
import { Location } from '@angular/common';
import { Component, DestroyRef, EventEmitter, OnInit } from '@angular/core';
import { Component, DestroyRef, EventEmitter, OnInit, signal } from '@angular/core';
import { Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Buffer } from 'buffer';
import { catchError, filter, map, startWith, tap, withLatestFrom } from 'rxjs/operators';
import { catchError, filter, map, startWith, take } from 'rxjs/operators';
import { ChangeType } from 'src/app/modules/changes/changes.component';
import { phoneValidator, requiredValidator } from 'src/app/modules/form-field/validators/validators';
import { InfoSectionType } from 'src/app/modules/info-section/info-section.component';
@@ -39,7 +38,7 @@ import {
combineLatestWith,
defer,
EMPTY,
fromEvent,
identity,
mergeWith,
Observable,
ObservedValueOf,
@@ -79,6 +78,7 @@ type MetadataQuery =
type UserWithHumanType = Omit<UserV2, 'type'> & { type: { case: 'human'; value: HumanUser } };
// todo: figure out why media matcher is needed
@Component({
selector: 'cnsl-user-detail',
templateUrl: './user-detail.component.html',
@@ -98,7 +98,7 @@ export class UserDetailComponent implements OnInit {
public refreshChanges$: EventEmitter<void> = new EventEmitter();
public InfoSectionType: any = InfoSectionType;
public currentSetting$: Observable<string | undefined>;
public currentSetting$ = signal<SidenavSetting>(GENERAL);
public settingsList$: Observable<SidenavSetting[]>;
public metadata$: Observable<MetadataQuery>;
public loginPolicy$: Observable<LoginPolicy>;
@@ -111,7 +111,6 @@ export class UserDetailComponent implements OnInit {
private _location: Location,
private dialog: MatDialog,
private router: Router,
private mediaMatcher: MediaMatcher,
public langSvc: LanguagesService,
private readonly userService: UserService,
private readonly newMgmtService: NewMgmtService,
@@ -126,9 +125,8 @@ export class UserDetailComponent implements OnInit {
}),
]);
this.currentSetting$ = this.getCurrentSetting$().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.user$ = this.getUser$().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.settingsList$ = this.getSettingsList$(this.user$);
this.settingsList$ = this.getSettingsList$(this.user$).pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.metadata$ = this.getMetadata$(this.user$).pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.loginPolicy$ = defer(() => this.newMgmtService.getLoginPolicy()).pipe(
@@ -177,31 +175,6 @@ export class UserDetailComponent implements OnInit {
);
}
private getCurrentSetting$(): Observable<string | undefined> {
const mediaq: string = '(max-width: 500px)';
const matcher = this.mediaMatcher.matchMedia(mediaq);
const small$ = fromEvent(matcher, 'change', ({ matches }: MediaQueryListEvent) => matches).pipe(
startWith(matcher.matches),
);
return this.route.queryParamMap.pipe(
map((params) => params.get('id')),
filter(Boolean),
startWith('general'),
withLatestFrom(small$),
map(([id, small]) => (small ? undefined : id)),
);
}
public async goToSetting(setting: string) {
await this.router.navigate([], {
relativeTo: this.route,
queryParams: { id: setting },
queryParamsHandling: 'merge',
skipLocationChange: true,
});
}
private getUserById(userId: string): Observable<UserQuery> {
return defer(() => this.userService.getUserById(userId)).pipe(
map(({ user }) => {
@@ -244,6 +217,20 @@ export class UserDetailComponent implements OnInit {
this.toast.showError(query.value);
}
});
const param = this.route.snapshot.queryParamMap.get('id');
if (!param) {
return;
}
this.settingsList$
.pipe(
takeUntilDestroyed(this.destroyRef),
map((settings) => settings.find(({ id }) => id === param)),
filter(Boolean),
take(1),
)
.subscribe((setting) => this.currentSetting$.set(setting));
}
public changeUsername(user: UserV2): void {
@@ -12,12 +12,7 @@
>
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table
[hideRefresh]="true"
[loading]="mfaQuery.state === 'loading'"
(refreshed)="refresh$.next(true)"
[dataSize]="mfaQuery.value.data.length"
>
<cnsl-refresh-table [hideRefresh]="true" [loading]="mfaQuery.state === 'loading'" (refreshed)="refresh$.next(true)">
<table class="table" mat-table [dataSource]="mfaQuery.value">
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef>{{ 'USER.MFA.TABLETYPE' | translate }}</th>
@@ -2,7 +2,6 @@
*ngIf="type$ | async as type"
[loading]="loading()"
(refreshed)="this.refresh$.next(true)"
[dataSize]="dataSize()"
[hideRefresh]="true"
[timestamp]="(users$ | async)?.details?.timestamp"
[selection]="selection"