From 2dc016ea3b533e95fbd07323451dc237cafc16d1 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Thu, 11 May 2023 10:18:14 +0200 Subject: [PATCH] feat(console): device code (#5771) * feat: device code * device code, create stepper * rm logs * app setup with device code * remove redirects if grant type is device code only * add device code app e2e --------- Co-authored-by: Fabi Co-authored-by: Elio Bischof --- .../app-auth-method-radio.component.html | 14 ++-- .../app-auth-method-radio.component.scss | 6 +- .../app-auth-method-radio.component.ts | 2 +- .../apps/app-create/app-create.component.html | 22 +++--- .../apps/app-create/app-create.component.ts | 14 +++- .../apps/app-detail/app-detail.component.ts | 29 +++++-- .../app/pages/projects/apps/authmethods.ts | 79 +++++++++++++++++-- console/src/assets/i18n/de.json | 7 +- console/src/assets/i18n/en.json | 7 +- console/src/assets/i18n/es.json | 7 +- console/src/assets/i18n/fr.json | 7 +- console/src/assets/i18n/it.json | 7 +- console/src/assets/i18n/ja.json | 7 +- console/src/assets/i18n/pl.json | 7 +- console/src/assets/i18n/zh.json | 7 +- .../e2e/applications/applications.cy.ts | 36 ++++++++- 16 files changed, 212 insertions(+), 46 deletions(-) diff --git a/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.html b/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.html index 5ab289448d..08b278854d 100644 --- a/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.html +++ b/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.html @@ -30,19 +30,23 @@
- {{ 'APP.OIDC.RESPONSETYPE' | translate }} + {{ 'APP.OIDC.RESPONSETYPE' | translate }} {{ 'APP.OIDC.RESPONSE.' + method.responseType.toString() | translate }}
- {{ 'APP.GRANT' | translate }} - {{ 'APP.OIDC.GRANT.' + method.grantType.toString() | translate }} + {{ 'APP.GRANT' | translate }} + {{ + 'APP.OIDC.GRANT.' + grant.toString() | translate + }}
- {{ 'APP.AUTHMETHOD' | translate }} + {{ 'APP.AUTHMETHOD' | translate }} {{ 'APP.OIDC.AUTHMETHOD.' + method.authMethod.toString() | translate }}
- {{ 'APP.AUTHMETHOD' | translate }} + {{ 'APP.AUTHMETHOD' | translate }} {{ 'APP.API.AUTHMETHOD.' + method.apiAuthMethod.toString() | translate }}
diff --git a/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.scss b/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.scss index f7ddc2d147..0abe726237 100644 --- a/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.scss +++ b/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.scss @@ -155,7 +155,11 @@ white-space: nowrap; } - :first-child { + .space { + margin-left: 0.5rem; + } + + .row-entry { margin-right: 1rem; overflow: hidden; text-overflow: ellipsis; diff --git a/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.ts b/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.ts index 48d232850c..4e9f64ab10 100644 --- a/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.ts +++ b/console/src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component.ts @@ -14,7 +14,7 @@ export interface RadioItemAuthType { prefix: string; background: string; responseType?: OIDCResponseType; - grantType?: OIDCGrantType; + grantType?: OIDCGrantType[]; authMethod?: OIDCAuthMethodType; apiAuthMethod?: APIAuthMethodType; recommended?: boolean; diff --git a/console/src/app/pages/projects/apps/app-create/app-create.component.html b/console/src/app/pages/projects/apps/app-create/app-create.component.html index 5e50ecb383..ab75a2c8f6 100644 --- a/console/src/app/pages/projects/apps/app-create/app-create.component.html +++ b/console/src/app/pages/projects/apps/app-create/app-create.component.html @@ -58,13 +58,9 @@ - + @@ -93,9 +89,11 @@ - - + {{ 'APP.OIDC.REDIRECTSECTION' | translate }}

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

@@ -431,7 +429,13 @@ -
+
{ beforeEach(() => { @@ -17,15 +18,15 @@ describe('applications', () => { beforeEach(`ensure it doesn't exist already`, () => { cy.get('@ctx').then((ctx) => { cy.get('@projectId').then((projectId) => { - ensureProjectResourceDoesntExist(ctx.api, projectId, Apps, testAppName); + ensureProjectResourceDoesntExist(ctx.api, projectId, Apps, testPKCEAppName); cy.visit(`/projects/${projectId}`); }); }); }); - it('add app', () => { + it('add web pkce app', () => { cy.get('[data-e2e="app-card-add"]').should('be.visible').click(); - cy.get('[formcontrolname="name"]').focus().type(testAppName); + cy.get('[formcontrolname="name"]').focus().type(testPKCEAppName); cy.get('[for="WEB"]').click(); cy.get('[data-e2e="continue-button-nameandtype"]').click(); cy.get('[for="PKCE"]').should('be.visible').click(); @@ -43,6 +44,33 @@ describe('applications', () => { }); }); + describe('add native device code app', () => { + beforeEach(`ensure it doesn't exist already`, () => { + cy.get('@ctx').then((ctx) => { + cy.get('@projectId').then((projectId) => { + ensureProjectResourceDoesntExist(ctx.api, projectId, Apps, testDEVICECODEAppName); + cy.visit(`/projects/${projectId}`); + }); + }); + }); + + it('add device code app', () => { + cy.get('[data-e2e="app-card-add"]').should('be.visible').click(); + cy.get('[formcontrolname="name"]').focus().type(testDEVICECODEAppName); + cy.get('[for="N"]').click(); + cy.get('[data-e2e="continue-button-nameandtype"]').click(); + cy.get('[for="DEVICECODE"]').should('be.visible').click(); + cy.get('[data-e2e="continue-button-authmethod"]').click(); + cy.get('[data-e2e="create-button"]').click(); + cy.get('[id*=overlay]').should('exist'); + cy.shouldConfirmSuccess(); + const expectClientId = new RegExp(`^.*[0-9]+\\@${testProjectName}.*$`); + cy.get('[data-e2e="client-id-copy"]').click(); + cy.contains('[data-e2e="client-id"]', expectClientId); + cy.clipboardMatches(expectClientId); + }); + }); + describe('edit app', () => { it('should configure an application to enable dev mode'); it('should configure an application to put user roles and info inside id token');