From 29831111ae7b1c5ba922e30956ff67eb188edfac Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Wed, 12 Aug 2020 08:22:24 +0200 Subject: [PATCH] feat(console): app compliance messages, dev mode (#575) * app compliance messages, show devmode * clnup * Update console/src/assets/i18n/de.json Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> * Update console/src/assets/i18n/en.json Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> * Update console/src/assets/i18n/de.json Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> --- .../apps/app-detail/app-detail.component.html | 12 ++++++++++++ .../apps/app-detail/app-detail.component.scss | 9 +++++++++ .../projects/apps/app-detail/app-detail.component.ts | 8 ++++++-- console/src/app/pages/projects/apps/apps.module.ts | 2 ++ console/src/app/services/project.service.ts | 6 +----- console/src/assets/i18n/de.json | 4 +++- console/src/assets/i18n/en.json | 6 ++++-- 7 files changed, 37 insertions(+), 10 deletions(-) diff --git a/console/src/app/pages/projects/apps/app-detail/app-detail.component.html b/console/src/app/pages/projects/apps/app-detail/app-detail.component.html index 65a9cf0d58..d5fd1658cd 100644 --- a/console/src/app/pages/projects/apps/app-detail/app-detail.component.html +++ b/console/src/app/pages/projects/apps/app-detail/app-detail.component.html @@ -43,6 +43,12 @@ + +
+

+ {{problem.localizedMessage}} +

+
@@ -85,6 +91,12 @@ + + + {{ 'APP.OIDC.DEVMODE' | translate }} + + +

{{'APP.OIDC.DEVMODEDESC' | translate}}

{{'APP.OIDC.REDIRECTDESCRIPTIONNATIVE' | translate}}

diff --git a/console/src/app/pages/projects/apps/app-detail/app-detail.component.scss b/console/src/app/pages/projects/apps/app-detail/app-detail.component.scss index 8c2ed88ce6..5665936da3 100644 --- a/console/src/app/pages/projects/apps/app-detail/app-detail.component.scss +++ b/console/src/app/pages/projects/apps/app-detail/app-detail.component.scss @@ -39,6 +39,10 @@ } } +.compliance .problem { + font-size: 14px; +} + .content { display: flex; flex-direction: row; @@ -62,6 +66,11 @@ } } + .devmode { + flex: 1 1 100%; + margin: 1rem .5rem; + } + .step-description { font-size: .9rem; color: #8795a1; diff --git a/console/src/app/pages/projects/apps/app-detail/app-detail.component.ts b/console/src/app/pages/projects/apps/app-detail/app-detail.component.ts index 47a0702a69..50e9506ccd 100644 --- a/console/src/app/pages/projects/apps/app-detail/app-detail.component.ts +++ b/console/src/app/pages/projects/apps/app-detail/app-detail.component.ts @@ -98,6 +98,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { name: ['', [Validators.required]], }); this.appForm = this.fb.group({ + devMode: [false, []], clientId: [{ value: '', disabled: true }], responseTypesList: [], grantTypesList: [], @@ -195,11 +196,9 @@ export class AppDetailComponent implements OnInit, OnDestroy { input.value = ''; } } - } public remove(redirect: any, target: RedirectType): void { - if (target === RedirectType.POSTREDIRECT) { const index = this.postLogoutRedirectUrisList.indexOf(redirect); @@ -228,6 +227,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { this.app.oidcConfig.authMethodType = this.authMethodType?.value; this.app.oidcConfig.redirectUrisList = this.redirectUrisList; this.app.oidcConfig.postLogoutRedirectUrisList = this.postLogoutRedirectUrisList; + this.app.oidcConfig.devMode = this.devMode?.value; this.projectService .UpdateOIDCAppConfig(this.projectId, this.app.id, this.app.oidcConfig) @@ -284,4 +284,8 @@ export class AppDetailComponent implements OnInit, OnDestroy { public get authMethodType(): AbstractControl | null { return this.appForm.get('authMethodType'); } + + public get devMode(): AbstractControl | null { + return this.appForm.get('devMode'); + } } diff --git a/console/src/app/pages/projects/apps/apps.module.ts b/console/src/app/pages/projects/apps/apps.module.ts index 9de2f41502..ff3c5208a7 100644 --- a/console/src/app/pages/projects/apps/apps.module.ts +++ b/console/src/app/pages/projects/apps/apps.module.ts @@ -14,6 +14,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatStepperModule } from '@angular/material/stepper'; import { MatTooltipModule } from '@angular/material/tooltip'; import { TranslateModule } from '@ngx-translate/core'; @@ -57,6 +58,7 @@ import { AppsRoutingModule } from './apps-routing.module'; MatStepperModule, MatRadioModule, CopyToClipboardModule, + MatSlideToggleModule, ], exports: [TranslateModule], }) diff --git a/console/src/app/services/project.service.ts b/console/src/app/services/project.service.ts index 17188f791b..1e238101a8 100644 --- a/console/src/app/services/project.service.ts +++ b/console/src/app/services/project.service.ts @@ -50,12 +50,7 @@ import { ProjectSearchRequest, ProjectSearchResponse, ProjectUpdateRequest, - ProjectUserGrantSearchRequest, ProjectView, - UserGrant, - UserGrantCreate, - UserGrantSearchQuery, - UserGrantSearchResponse, ZitadelDocs, } from '../proto/generated/management_pb'; import { GrpcBackendService } from './grpc-backend.service'; @@ -588,6 +583,7 @@ export class ProjectService { req.setPostLogoutRedirectUrisList(oidcConfig.postLogoutRedirectUrisList); req.setGrantTypesList(oidcConfig.grantTypesList); req.setApplicationType(oidcConfig.applicationType); + req.setDevMode(oidcConfig.devMode); return await this.request( c => c.updateApplicationOIDCConfig, req, diff --git a/console/src/assets/i18n/de.json b/console/src/assets/i18n/de.json index 1130457d4b..0d70c8c03c 100644 --- a/console/src/assets/i18n/de.json +++ b/console/src/assets/i18n/de.json @@ -562,7 +562,7 @@ "TITLEFIRST":"Geben Sie zuerst einen Namen ein!", "TYPETITLE":"Welche Art von Applikation möchtest du erstellen?", "REDIRECTTITLE":"Wohin soll nach dem Login weitergeleitet werden?", - "REDIRECTDESCRIPTIONWEB":"Der redirect muss mit https:// beginnen. http:// ist nur für Testzwecke zulässig!", + "REDIRECTDESCRIPTIONWEB":"Der redirect muss mit https:// beginnen. http:// ist nur im Dev Mode zulässig!", "REDIRECTDESCRIPTIONNATIVE":"Die Weiterleitung muss mit einem eigenen Protokoll oder http://localhost beginnen!", "REDIRECTNOTVALID":"Diese Weiterleitung ist nicht zulässig!", "POSTREDIRECTTITLE":"Das ist die Weiterleitung nach einem logout.", @@ -572,6 +572,8 @@ "CLIENTSECRET": "Client Secret", "CLIENTSECRET_DESCRIPTION": "Speichere das Client Secret, da es verschwindet, sobald der Dialog geschlossen wird!", "REGENERATESECRET": "Client Secret neu generieren", + "DEVMODE":"Dev Mode", + "DEVMODEDESC":"Bei eingeschaltetem Dev Mode werden die Redirect Uris im OIDC Flow nicht validiert.", "REDIRECT": "Redirect URIs", "REDIRECTSECTION": "Redirect URIs", "POSTLOGOUTREDIRECT":"Post logout URIs", diff --git a/console/src/assets/i18n/en.json b/console/src/assets/i18n/en.json index 478021212e..b1f23e64ed 100644 --- a/console/src/assets/i18n/en.json +++ b/console/src/assets/i18n/en.json @@ -563,8 +563,8 @@ "TYPETITLE":"What type of application do you want to create?", "REDIRECTTITLE":"Specify the urls where the login will redirect to.", "POSTREDIRECTTITLE":"This is the redirect after logout.", - "REDIRECTDESCRIPTIONWEB":"The redirect has to begin with https://. http:// is only valid for testing purposes!", - "REDIRECTDESCRIPTIONNATIVE":"The redirect has to begin with your own protocol or http://localhost!", + "REDIRECTDESCRIPTIONWEB":"Redirects must begin with https://. http:// is only valid with enabled dev mode.", + "REDIRECTDESCRIPTIONNATIVE":"Redirects must begin with your own protocol or http://localhost!", "REDIRECTNOTVALID":"This redirect is not valid!", "TYPEREQUIRED":"The type is required!", "TITLE": "OIDC Configuration", @@ -572,6 +572,8 @@ "CLIENTSECRET": "Client Secret", "CLIENTSECRET_DESCRIPTION": "Save your Client Secret as it will disappear once the dialog is closed!", "REGENERATESECRET": "Regenerate Client Secret", + "DEVMODE":"Dev Mode", + "DEVMODEDESC":"With enabled dev mode, redirect uris will not be validated!", "REDIRECT": "Redirect URIs", "REDIRECTSECTION": "Redirect URIs", "POSTLOGOUTREDIRECT":"Post logout URIs",