From 7dfc26305245402eb81a75be3db1db9888f2767b Mon Sep 17 00:00:00 2001 From: Stan Silvert Date: Mon, 25 Mar 2024 08:33:39 -0400 Subject: [PATCH] Add Token setting Lifetime of Request URI for PAR (#28155) * Add Token setting Lifetime of Request URI for PAR Signed-off-by: Stan Silvert * Fix test. Signed-off-by: Stan Silvert --------- Signed-off-by: Stan Silvert --- .../e2e/realm_settings_events_test.spec.ts | 4 +++ .../realm_settings/RealmSettingsPage.ts | 17 ++++++++++--- .../admin/messages/messages_en.properties | 2 ++ .../admin-ui/src/realm-settings/TokensTab.tsx | 25 +++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/js/apps/admin-ui/cypress/e2e/realm_settings_events_test.spec.ts b/js/apps/admin-ui/cypress/e2e/realm_settings_events_test.spec.ts index 0fbad917c8..ff334d20ec 100644 --- a/js/apps/admin-ui/cypress/e2e/realm_settings_events_test.spec.ts +++ b/js/apps/admin-ui/cypress/e2e/realm_settings_events_test.spec.ts @@ -344,6 +344,10 @@ describe("Realm settings events tab tests", () => { "have.value", 1, ); + cy.findByTestId(realmSettingsPage.parRequestUriLifespanInput).should( + "have.value", + 2, + ); cy.findByTestId(realmSettingsPage.accessTokenLifespanImplicitInput).should( "have.value", 2, diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/realm_settings/RealmSettingsPage.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/realm_settings/RealmSettingsPage.ts index ed721867a7..d58620a490 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/realm_settings/RealmSettingsPage.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/realm_settings/RealmSettingsPage.ts @@ -116,6 +116,7 @@ export default class RealmSettingsPage extends CommonPage { revokeRefreshTokenSwitch = "revoke-refresh-token-switch"; accessTokenLifespanInput = "access-token-lifespan-input"; accessTokenLifespanImplicitInput = "access-token-lifespan-implicit-input"; + parRequestUriLifespanInput = "par-request-uri-lifespan-input"; clientLoginTimeoutInput = "client-login-timeout-input"; offlineSessionMaxInput = "offline-session-max-input"; userInitiatedActionLifespanInput = "user-initiated-action-lifespan"; @@ -129,6 +130,10 @@ export default class RealmSettingsPage extends CommonPage { accessTokenLifespanSelectMenuList = "#kc-access-token-lifespan-select-menu > div > ul"; + parRequestUriLifespanSelectMenu = "#par-request-uri-lifespan-select-menu"; + parRequestUriLifespanSelectMenuList = + "#par-request-uri-lifespan-select-menu > div > ul"; + accessTokenLifespanImplicitSelectMenu = "#kc-access-token-lifespan-implicit-select-menu"; accessTokenLifespanImplicitSelectMenuList = @@ -631,6 +636,12 @@ export default class RealmSettingsPage extends CommonPage { this.accessTokenLifespanImplicitSelectMenu, this.accessTokenLifespanImplicitSelectMenuList, ); + cy.findByTestId("par-request-uri-lifespan-input").clear().type("2"); + this.changeTimeUnit( + "Hours", + this.parRequestUriLifespanSelectMenu, + this.parRequestUriLifespanSelectMenuList, + ); cy.findByTestId(this.clientLoginTimeoutInput).clear().type("3"); this.changeTimeUnit( @@ -1014,16 +1025,16 @@ export default class RealmSettingsPage extends CommonPage { cy.findByTestId(this.#jsonEditorReloadBtn).click(); cy.get(this.#jsonEditor).type(`{pageup}{del} [{ - "name": "Reload", + "name": "Reload", }, {downarrow}{end}{backspace}{backspace}{backspace}{backspace}`); cy.findByTestId(this.#jsonEditorReloadBtn).click(); cy.get(this.#jsonEditor).type(`{pageup}{del} [{ - "name": "Test", + "name": "Test", "description": "Test Description", "enabled": false, - "conditions": [], + "conditions": [], "profiles": [], }, {downarrow}{end}{backspace}{backspace}{backspace}{backspace}`); diff --git a/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties b/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties index 3cc409047d..ab2b3ee2e5 100644 --- a/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties +++ b/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties @@ -3113,3 +3113,5 @@ senderEnvelopePlaceholder=Sender envelope email address smtpPortPlaceholder=SMTP port (defaults to 25) loginUsernamePlaceholder=Login username ownerHelp=Owner for this resource. +parRequestUriLifespan=Lifetime of the Request URI for Pushed Authorization Request +parRequestUriLifespanHelp=Number that represents the lifetime of the request URI. The default value is 1 minute. diff --git a/js/apps/admin-ui/src/realm-settings/TokensTab.tsx b/js/apps/admin-ui/src/realm-settings/TokensTab.tsx index f7d5588084..14ce4d844e 100644 --- a/js/apps/admin-ui/src/realm-settings/TokensTab.tsx +++ b/js/apps/admin-ui/src/realm-settings/TokensTab.tsx @@ -200,6 +200,31 @@ export const RealmSettingsTokensTab = ({ {...form.register("attributes.shortVerificationUri")} /> + + } + > + ( + + )} + /> + )}