mirror of
https://github.com/zitadel/zitadel.git
synced 2025-11-16 03:34:48 +00:00
* get auth policy, fix increment from 0 * seo, accessibility * ngsw rem check for update * organize interceptors * toast i18n part1 * show loginname * use primary color * toast login handler, fix user session type * Update console/src/assets/i18n/de.json Co-authored-by: Florian Forster <florian@caos.ch> * Update console/src/assets/i18n/de.json Co-authored-by: Florian Forster <florian@caos.ch> * Update console/src/assets/i18n/de.json Co-authored-by: Florian Forster <florian@caos.ch> * Update console/src/assets/i18n/en.json Co-authored-by: Florian Forster <florian@caos.ch> * Update console/src/index.html Co-authored-by: Florian Forster <florian@caos.ch> * Update console/src/assets/i18n/en.json Co-authored-by: Florian Forster <florian@caos.ch> * Update console/src/assets/i18n/en.json Co-authored-by: Florian Forster <florian@caos.ch> Co-authored-by: Florian Forster <florian@caos.ch>
27 lines
885 B
TypeScript
27 lines
885 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Metadata } from 'grpc-web';
|
|
|
|
import { Org } from '../../proto/generated/auth_pb';
|
|
import { GrpcHandler } from '../grpc-handler';
|
|
import { StorageService } from '../storage.service';
|
|
import { GrpcInterceptor } from './grpc-interceptor';
|
|
|
|
const orgKey = 'x-zitadel-orgid';
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class GrpcOrgInterceptor implements GrpcInterceptor {
|
|
constructor(private readonly storageService: StorageService) { }
|
|
|
|
public async intercept(
|
|
req: unknown,
|
|
metadata: Metadata,
|
|
next: GrpcHandler,
|
|
): Promise<any> {
|
|
const org: Org.AsObject | null = (this.storageService.getItem('organization'));
|
|
if (!metadata[orgKey] && org) {
|
|
metadata[orgKey] = org.id ?? '';
|
|
}
|
|
return await next.handle(req, metadata);
|
|
}
|
|
}
|