mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-05 08:12:03 +00:00
feat: port reduction (#323)
* move mgmt pkg * begin package restructure * rename auth package to authz * begin start api * move auth * move admin * fix merge * configs and interceptors * interceptor * revert generate-grpc.sh * some cleanups * console * move console * fix tests and merging * js linting * merge * merging and configs * change k8s base to current ports * fixes * cleanup * regenerate proto * remove unnecessary whitespace * missing param * go mod tidy * fix merging * move login pkg * cleanup * move api pkgs again * fix pkg naming * fix generate-static.sh for login * update workflow * fixes * logging * remove duplicate * comment for optional gateway interfaces * regenerate protos * fix proto imports for grpc web * protos * grpc web generate * grpc web generate * fix changes * add translation interceptor * fix merging * regenerate mgmt proto
This commit is contained in:
@@ -1,48 +1,54 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { AdminServicePromiseClient } from '../proto/generated/admin_grpc_web_pb';
|
||||
import { AuthServicePromiseClient } from '../proto/generated/auth_grpc_web_pb';
|
||||
import { ManagementServicePromiseClient } from '../proto/generated/management_grpc_web_pb';
|
||||
import { GrpcRequestFn } from './grpc-handler';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GrpcService {
|
||||
public issuer: string = '';
|
||||
public clientid: string = '';
|
||||
|
||||
public auth!: AuthServicePromiseClient;
|
||||
public mgmt!: ManagementServicePromiseClient;
|
||||
public admin!: AdminServicePromiseClient;
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
) { }
|
||||
|
||||
public async loadAppEnvironment(): Promise<any> {
|
||||
return this.http.get('/assets/environment.json')
|
||||
.toPromise().then((data: any) => {
|
||||
if (data && data.authServiceUrl && data.mgmtServiceUrl && data.issuer) {
|
||||
this.auth = new AuthServicePromiseClient(data.authServiceUrl);
|
||||
this.mgmt = new ManagementServicePromiseClient(data.mgmtServiceUrl);
|
||||
this.admin = new AdminServicePromiseClient(data.adminServiceUrl);
|
||||
|
||||
this.issuer = data.issuer;
|
||||
if (data.clientid) {
|
||||
this.clientid = data.clientid;
|
||||
}
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
}).catch(() => {
|
||||
console.log('Failed to load environment from assets');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export type RequestFactory<TClient, TReq, TResp> = (
|
||||
client: TClient,
|
||||
) => GrpcRequestFn<TReq, TResp>;
|
||||
|
||||
export type ResponseMapper<TResp, TMappedResp> = (resp: TResp) => TMappedResp;
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { PlatformLocation } from '@angular/common';
|
||||
|
||||
import { AdminServicePromiseClient } from '../proto/generated/admin_grpc_web_pb';
|
||||
import { AuthServicePromiseClient } from '../proto/generated/auth_grpc_web_pb';
|
||||
import { ManagementServicePromiseClient } from '../proto/generated/management_grpc_web_pb';
|
||||
import { GrpcRequestFn } from './grpc-handler';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GrpcService {
|
||||
public issuer: string = '';
|
||||
public clientid: string = '';
|
||||
public redirectUri: string = '';
|
||||
public postLogoutRedirectUri: string = '';
|
||||
|
||||
public auth!: AuthServicePromiseClient;
|
||||
public mgmt!: ManagementServicePromiseClient;
|
||||
public admin!: AdminServicePromiseClient;
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private platformLocation: PlatformLocation,
|
||||
) { }
|
||||
|
||||
public async loadAppEnvironment(): Promise<any> {
|
||||
return this.http.get('./assets/environment.json')
|
||||
.toPromise().then((data: any) => {
|
||||
if (data && data.authServiceUrl && data.mgmtServiceUrl && data.issuer) {
|
||||
this.auth = new AuthServicePromiseClient(data.authServiceUrl);
|
||||
this.mgmt = new ManagementServicePromiseClient(data.mgmtServiceUrl);
|
||||
this.admin = new AdminServicePromiseClient(data.adminServiceUrl);
|
||||
|
||||
this.issuer = data.issuer;
|
||||
if (data.clientid) {
|
||||
this.clientid = data.clientid;
|
||||
this.redirectUri = window.location.origin + this.platformLocation.getBaseHrefFromDOM() + 'auth/callback';
|
||||
this.postLogoutRedirectUri = window.location.origin + this.platformLocation.getBaseHrefFromDOM() + 'signedout';
|
||||
}
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
}).catch(() => {
|
||||
console.log('Failed to load environment from assets');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export type RequestFactory<TClient, TReq, TResp> = (
|
||||
client: TClient,
|
||||
) => GrpcRequestFn<TReq, TResp>;
|
||||
|
||||
export type ResponseMapper<TResp, TMappedResp> = (resp: TResp) => TMappedResp;
|
||||
|
||||
Reference in New Issue
Block a user