fix: console build (#194)

* grpc gen, headers

* add auth headers

* resolve build errors

* lint

* project grant changes

* project detail

* owned projects

* fix undefined
This commit is contained in:
Max Peintner
2020-06-09 17:12:35 +02:00
committed by GitHub
parent 25b97b1bcc
commit ef9b03cc84
34 changed files with 8916 additions and 3729 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Metadata } from 'grpc-web';
import { AdminServicePromiseClient } from '../proto/generated/admin_grpc_web_pb';
import { CreateOrgRequest, OrgSetUpRequest, OrgSetUpResponse, RegisterUserRequest } from '../proto/generated/admin_pb';
import { CreateOrgRequest, CreateUserRequest, OrgSetUpRequest, OrgSetUpResponse } from '../proto/generated/admin_pb';
import { GrpcBackendService } from './grpc-backend.service';
import { GrpcService, RequestFactory, ResponseMapper } from './grpc.service';
@@ -29,7 +29,7 @@ export class AdminService {
public async SetUpOrg(
createOrgRequest: CreateOrgRequest,
registerUserRequest: RegisterUserRequest,
registerUserRequest: CreateUserRequest,
): Promise<OrgSetUpResponse> {
const req: OrgSetUpRequest = new OrgSetUpRequest();
@@ -14,5 +14,4 @@ export class AuthInterceptorService implements HttpInterceptor {
return next.handle(req);
}
}
+1 -13
View File
@@ -12,7 +12,6 @@ import {
MyProjectOrgSearchRequest,
MyProjectOrgSearchResponse,
PasswordChange,
PasswordRequest,
UpdateUserAddressRequest,
UpdateUserEmailRequest,
UpdateUserPhoneRequest,
@@ -196,17 +195,6 @@ export class AuthUserService {
);
}
public async SetMyPassword(id: string): Promise<Empty> {
const req = new PasswordRequest();
req.setPassword(id);
return await this.request(
c => c.setMyPassword,
req,
f => f,
);
}
public async ChangeMyPassword(oldPassword: string, newPassword: string): Promise<Empty> {
const req = new PasswordChange();
req.setOldPassword(oldPassword);
@@ -234,7 +222,7 @@ export class AuthUserService {
);
}
public async VerifyMfaOTP(code: string): Promise<MfaOtpResponse> {
public async VerifyMfaOTP(code: string): Promise<Empty> {
const req = new VerifyMfaOtp();
req.setCode(code);
return await this.request(
+2
View File
@@ -65,6 +65,8 @@ export class AuthService {
this.config.issuer = config?.issuer || this.grpcService.issuer;
this.config.clientId = config?.clientId || this.grpcService.clientid;
this.config.customQueryParams = config?.customQueryParams;
console.log(this.config);
this.oauthService.configure(this.config);
// this.oauthService.setupAutomaticSilentRefresh();
this.oauthService.strictDiscoveryDocumentValidation = false;
@@ -22,6 +22,9 @@ export class GrpcOrgInterceptor implements GrpcInterceptor {
metadata[orgKey] = org.id ?? '';
}
// metadata['x-zitadel-login'] = 'true';
// metadata['x-zitadel-userid'] = '58922557365027097';
// metadata['x-zitadel-orgid'] = '58922556878487833';
return await next.handle(req, metadata);
}
}
+1
View File
@@ -31,6 +31,7 @@ export class GrpcService {
this.issuer = data.issuer;
if (data.clientid) {
console.log(data.clientid);
this.clientid = data.clientid;
}
}
+33 -19
View File
@@ -10,7 +10,9 @@ import {
ApplicationSearchRequest,
ApplicationSearchResponse,
ApplicationUpdate,
GrantedGrantID,
GrantedProjectSearchQuery,
GrantedProjectSearchRequest,
GrantedProjectSearchResponse,
OIDCApplicationCreate,
OIDCConfig,
OIDCConfigUpdate,
@@ -38,9 +40,6 @@ import {
ProjectRoleSearchQuery,
ProjectRoleSearchRequest,
ProjectRoleSearchResponse,
ProjectSearchQuery,
ProjectSearchRequest,
ProjectSearchResponse,
ProjectUpdateRequest,
ProjectUserGrantSearchRequest,
UserGrant,
@@ -72,21 +71,36 @@ export class ProjectService {
return responseMapper(response);
}
public async SearchProjects(
limit: number, offset: number, queryList?: ProjectSearchQuery[]): Promise<ProjectSearchResponse> {
const req = new ProjectSearchRequest();
public async SearchGrantedProjects(
limit: number, offset: number, queryList?: GrantedProjectSearchQuery[]): Promise<GrantedProjectSearchResponse> {
const req = new GrantedProjectSearchRequest();
req.setLimit(limit);
req.setOffset(offset);
if (queryList) {
req.setQueriesList(queryList);
}
return await this.request(
c => c.searchProjects,
c => c.searchGrantedProjects,
req,
f => f,
);
}
// public async SearchGrantedProjects(
// limit: number, offset: number, queryList?: GrantedProjectSearchQuery[]): Promise<GrantedProjectSearchResponse> {
// const req = new GrantedProjectSearchRequest();
// req.setLimit(limit);
// req.setOffset(offset);
// if (queryList) {
// req.setQueriesList(queryList);
// }
// return await this.request(
// c => c.search,
// req,
// f => f,
// );
// }
public async GetProjectById(projectId: string): Promise<Project> {
const req = new ProjectID();
req.setId(projectId);
@@ -97,6 +111,17 @@ export class ProjectService {
);
}
public async GetGrantedProjectGrantByID(projectId: string, id: string): Promise<ProjectGrant> {
const req = new ProjectGrantID();
req.setId(id);
req.setProjectId(projectId);
return await this.request(
c => c.getGrantedProjectGrantByID,
req,
f => f,
);
}
public async CreateProject(project: ProjectCreateRequest.AsObject): Promise<Project> {
const req = new ProjectCreateRequest();
req.setName(project.name);
@@ -368,17 +393,6 @@ export class ProjectService {
);
}
// NEW
public async GetGrantedProjectGrantByID(id: string): Promise<ProjectGrant> {
const req = new GrantedGrantID();
req.setId(id);
return await this.request(
c => c.getGrantedProjectGrantByID,
req,
f => f,
);
}
public async GetProjectMemberRoles(): Promise<ProjectMemberRoles> {
const req = new Empty();
return await this.request(