mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 20:27:32 +00:00
fix console types, eliminate webkey feature
This commit is contained in:
@@ -139,7 +139,7 @@ export class FeaturesComponent {
|
|||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
// to save special flags they have to be handled here
|
// to save special flags they have to be handled here
|
||||||
req.loginV2 = {
|
req['loginV2'] = {
|
||||||
required: toggleStates.loginV2.enabled,
|
required: toggleStates.loginV2.enabled,
|
||||||
baseUri: toggleStates.loginV2.baseUri,
|
baseUri: toggleStates.loginV2.baseUri,
|
||||||
};
|
};
|
||||||
|
@@ -89,7 +89,7 @@ export class ActionTwoAddTargetDialogComponent {
|
|||||||
nanos: 0,
|
nanos: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const targetType: Extract<MessageInitShape<typeof CreateTargetRequestSchema>['targetType'], { case: TargetTypes }> =
|
const targetType: MessageInitShape<typeof CreateTargetRequestSchema>['targetType'] =
|
||||||
type === 'restWebhook'
|
type === 'restWebhook'
|
||||||
? { case: type, value: { interruptOnError } }
|
? { case: type, value: { interruptOnError } }
|
||||||
: type === 'restCall'
|
: type === 'restCall'
|
||||||
|
@@ -22,9 +22,8 @@ const CACHE_WARNING_MS = 5 * 60 * 1000; // 5 minutes
|
|||||||
templateUrl: './oidc-webkeys.component.html',
|
templateUrl: './oidc-webkeys.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class OidcWebKeysComponent implements OnInit {
|
export class OidcWebKeysComponent {
|
||||||
protected readonly refresh = new Subject<true>();
|
protected readonly refresh = new Subject<true>();
|
||||||
protected readonly webKeysEnabled$: Observable<boolean>;
|
|
||||||
protected readonly webKeys$: Observable<WebKey[]>;
|
protected readonly webKeys$: Observable<WebKey[]>;
|
||||||
protected readonly inactiveWebKeys$: Observable<WebKey[]>;
|
protected readonly inactiveWebKeys$: Observable<WebKey[]>;
|
||||||
protected readonly nextWebKeyCandidate$: Observable<WebKey | undefined>;
|
protected readonly nextWebKeyCandidate$: Observable<WebKey | undefined>;
|
||||||
@@ -34,17 +33,12 @@ export class OidcWebKeysComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly webKeysService: WebKeysService,
|
private readonly webKeysService: WebKeysService,
|
||||||
private readonly featureService: NewFeatureService,
|
|
||||||
private readonly toast: ToastService,
|
private readonly toast: ToastService,
|
||||||
private readonly timestampToDatePipe: TimestampToDatePipe,
|
private readonly timestampToDatePipe: TimestampToDatePipe,
|
||||||
private readonly dialog: MatDialog,
|
private readonly dialog: MatDialog,
|
||||||
private readonly destroyRef: DestroyRef,
|
private readonly destroyRef: DestroyRef,
|
||||||
private readonly router: Router,
|
|
||||||
private readonly route: ActivatedRoute,
|
|
||||||
) {
|
) {
|
||||||
this.webKeysEnabled$ = this.getWebKeysEnabled().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
|
const webKeys$ = this.getWebKeys().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
|
||||||
|
|
||||||
const webKeys$ = this.getWebKeys(this.webKeysEnabled$).pipe(shareReplay({ refCount: true, bufferSize: 1 }));
|
|
||||||
|
|
||||||
this.webKeys$ = webKeys$.pipe(map((webKeys) => webKeys.filter((webKey) => webKey.state !== State.INACTIVE)));
|
this.webKeys$ = webKeys$.pipe(map((webKeys) => webKeys.filter((webKey) => webKey.state !== State.INACTIVE)));
|
||||||
this.inactiveWebKeys$ = webKeys$.pipe(map((webKeys) => webKeys.filter((webKey) => webKey.state === State.INACTIVE)));
|
this.inactiveWebKeys$ = webKeys$.pipe(map((webKeys) => webKeys.filter((webKey) => webKey.state === State.INACTIVE)));
|
||||||
@@ -52,34 +46,7 @@ export class OidcWebKeysComponent implements OnInit {
|
|||||||
this.nextWebKeyCandidate$ = this.getNextWebKeyCandidate(this.webKeys$);
|
this.nextWebKeyCandidate$ = this.getNextWebKeyCandidate(this.webKeys$);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
private getWebKeys() {
|
||||||
// redirect away from this page if web keys are not enabled
|
|
||||||
// this also preloads the web keys enabled state
|
|
||||||
this.webKeysEnabled$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(async (webKeysEnabled) => {
|
|
||||||
if (webKeysEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await this.router.navigate([], {
|
|
||||||
relativeTo: this.route,
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
queryParams: {
|
|
||||||
id: null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private getWebKeysEnabled() {
|
|
||||||
return defer(() => this.featureService.getInstanceFeatures()).pipe(
|
|
||||||
map((features) => features.webKey?.enabled ?? false),
|
|
||||||
catchError((err) => {
|
|
||||||
this.toast.showError(err);
|
|
||||||
return of(false);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private getWebKeys(webKeysEnabled$: Observable<boolean>) {
|
|
||||||
return this.refresh.pipe(
|
return this.refresh.pipe(
|
||||||
startWith(true),
|
startWith(true),
|
||||||
switchMap(() => {
|
switchMap(() => {
|
||||||
@@ -87,12 +54,6 @@ export class OidcWebKeysComponent implements OnInit {
|
|||||||
}),
|
}),
|
||||||
map(({ webKeys }) => webKeys),
|
map(({ webKeys }) => webKeys),
|
||||||
catchError(async (err) => {
|
catchError(async (err) => {
|
||||||
const webKeysEnabled = await firstValueFrom(webKeysEnabled$);
|
|
||||||
// suppress errors if web keys are not enabled
|
|
||||||
if (!webKeysEnabled) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.toast.showError(err);
|
this.toast.showError(err);
|
||||||
return [];
|
return [];
|
||||||
}),
|
}),
|
||||||
|
@@ -204,7 +204,7 @@ export class UserCreateV2Component implements OnInit {
|
|||||||
|
|
||||||
if (authenticationFactor.factor === 'initialPassword') {
|
if (authenticationFactor.factor === 'initialPassword') {
|
||||||
const { password } = authenticationFactor.form.getRawValue();
|
const { password } = authenticationFactor.form.getRawValue();
|
||||||
humanReq.passwordType = {
|
humanReq['passwordType'] = {
|
||||||
case: 'password',
|
case: 'password',
|
||||||
value: {
|
value: {
|
||||||
password,
|
password,
|
||||||
|
@@ -8,12 +8,14 @@ import { Gender, HumanProfile, HumanProfileSchema } from '@zitadel/proto/zitadel
|
|||||||
import { filter, startWith } from 'rxjs/operators';
|
import { filter, startWith } from 'rxjs/operators';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
import { Profile } from '@zitadel/proto/zitadel/user_pb';
|
import { Profile } from '@zitadel/proto/zitadel/user_pb';
|
||||||
import { create } from '@bufbuild/protobuf';
|
//@ts-ignore
|
||||||
|
import { create } from '@zitadel/client';
|
||||||
|
|
||||||
function toHumanProfile(profile: HumanProfile | Profile): HumanProfile {
|
function toHumanProfile(profile: HumanProfile | Profile): HumanProfile {
|
||||||
if (profile.$typeName === 'zitadel.user.v2.HumanProfile') {
|
if (profile.$typeName === 'zitadel.user.v2.HumanProfile') {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
return create(HumanProfileSchema, {
|
return create(HumanProfileSchema, {
|
||||||
givenName: profile.firstName,
|
givenName: profile.firstName,
|
||||||
familyName: profile.lastName,
|
familyName: profile.lastName,
|
||||||
|
@@ -36,10 +36,10 @@ import { AuthenticationService } from 'src/app/services/authentication.service';
|
|||||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||||
import { UserState as UserStateV1 } from 'src/app/proto/generated/zitadel/user_pb';
|
import { UserState as UserStateV1 } from 'src/app/proto/generated/zitadel/user_pb';
|
||||||
|
|
||||||
type Query = Exclude<
|
type ListUsersRequest = MessageInitShape<typeof ListUsersRequestSchema>;
|
||||||
Exclude<MessageInitShape<typeof ListUsersRequestSchema>['queries'], undefined>[number]['query'],
|
type QueriesArray = NonNullable<ListUsersRequest['queries']>;
|
||||||
undefined
|
type QueryWrapper = QueriesArray extends readonly (infer T)[] ? T : never;
|
||||||
>;
|
type Query = NonNullable<QueryWrapper extends { query?: infer Q } ? Q : never>;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'cnsl-user-table',
|
selector: 'cnsl-user-table',
|
||||||
|
Reference in New Issue
Block a user