feat(console): grpc web interceptors, cleanup services (#631)

* managementservice, authservice, change all refs

* refactor grpc auth

* fix references

* interceptor logic

* new interceptor

* appinitializers, environment loader, interceptors

* remove circular dep

* init authconfig in grpc service

* authconfig

* lint

* update mgmt service

* fix references

* update clientid, fix interceptor

* rm unused authconfig

* todo auth interceptor
This commit is contained in:
Max Peintner
2020-08-29 10:43:35 +02:00
committed by GitHub
parent 40b8faaddd
commit eeea1f1c4b
81 changed files with 1877 additions and 2639 deletions
@@ -15,7 +15,7 @@ import {
OIDCGrantType,
OIDCResponseType,
} from 'src/app/proto/generated/management_pb';
import { ProjectService } from 'src/app/services/project.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { AppSecretDialogComponent } from '../app-secret-dialog/app-secret-dialog.component';
@@ -84,7 +84,7 @@ export class AppCreateComponent implements OnInit, OnDestroy {
private route: ActivatedRoute,
private toast: ToastService,
private dialog: MatDialog,
private projectService: ProjectService,
private mgmtService: ManagementService,
private fb: FormBuilder,
private _location: Location,
) {
@@ -186,7 +186,7 @@ export class AppCreateComponent implements OnInit, OnDestroy {
public saveOIDCApp(): void {
this.loading = true;
this.projectService
this.mgmtService
.CreateOIDCApp(this.oidcApp)
.then((data: Application) => {
this.loading = false;
@@ -18,8 +18,7 @@ import {
OIDCResponseType,
ZitadelDocs,
} from 'src/app/proto/generated/management_pb';
import { OrgService } from 'src/app/services/org.service';
import { ProjectService } from 'src/app/services/project.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { AppSecretDialogComponent } from '../app-secret-dialog/app-secret-dialog.component';
@@ -88,11 +87,10 @@ export class AppDetailComponent implements OnInit, OnDestroy {
public translate: TranslateService,
private route: ActivatedRoute,
private toast: ToastService,
private projectService: ProjectService,
private fb: FormBuilder,
private _location: Location,
private dialog: MatDialog,
private orgService: OrgService,
private mgmtService: ManagementService,
) {
this.appNameForm = this.fb.group({
state: ['', []],
@@ -118,11 +116,11 @@ export class AppDetailComponent implements OnInit, OnDestroy {
private async getData({ projectid, id }: Params): Promise<void> {
this.projectId = projectid;
this.orgService.GetIam().then(iam => {
this.mgmtService.GetIam().then(iam => {
this.isZitadel = iam.toObject().iamProjectId === this.projectId;
});
this.projectService.GetApplicationById(projectid, id).then(app => {
this.mgmtService.GetApplicationById(projectid, id).then(app => {
this.app = app.toObject();
this.appNameForm.patchValue(this.app);
@@ -151,18 +149,18 @@ export class AppDetailComponent implements OnInit, OnDestroy {
this.errorMessage = error.message;
});
this.docs = (await this.projectService.GetZitadelDocs()).toObject();
this.docs = (await this.mgmtService.GetZitadelDocs()).toObject();
}
public changeState(event: MatButtonToggleChange): void {
if (event.value === AppState.APPSTATE_ACTIVE) {
this.projectService.ReactivateApplication(this.projectId, this.app.id).then(() => {
this.mgmtService.ReactivateApplication(this.projectId, this.app.id).then(() => {
this.toast.showInfo('APP.TOAST.REACTIVATED', true);
}).catch((error: any) => {
this.toast.showError(error);
});
} else if (event.value === AppState.APPSTATE_INACTIVE) {
this.projectService.DeactivateApplication(this.projectId, this.app.id).then(() => {
this.mgmtService.DeactivateApplication(this.projectId, this.app.id).then(() => {
this.toast.showInfo('APP.TOAST.REACTIVATED', true);
}).catch((error: any) => {
this.toast.showError(error);
@@ -230,7 +228,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
this.app.oidcConfig.postLogoutRedirectUrisList = this.postLogoutRedirectUrisList;
this.app.oidcConfig.devMode = this.devMode?.value;
this.projectService
this.mgmtService
.UpdateOIDCAppConfig(this.projectId, this.app.id, this.app.oidcConfig)
.then(() => {
this.toast.showInfo('APP.TOAST.OIDCUPDATED', true);
@@ -243,7 +241,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
}
public regenerateOIDCClientSecret(): void {
this.projectService.RegenerateOIDCClientSecret(this.app.id, this.projectId).then((data: OIDCConfig) => {
this.mgmtService.RegenerateOIDCClientSecret(this.app.id, this.projectId).then((data: OIDCConfig) => {
this.toast.showInfo('APP.TOAST.OIDCCLIENTSECRETREGENERATED', true);
this.dialog.open(AppSecretDialogComponent, {
data: {