diff --git a/js/apps/admin-ui/cypress/e2e/clients_test.spec.ts b/js/apps/admin-ui/cypress/e2e/clients_test.spec.ts index 32bbabd073..7ad6808e6f 100644 --- a/js/apps/admin-ui/cypress/e2e/clients_test.spec.ts +++ b/js/apps/admin-ui/cypress/e2e/clients_test.spec.ts @@ -20,6 +20,7 @@ import CommonPage from "../support/pages/CommonPage"; import AttributesTab from "../support/pages/admin-ui/manage/AttributesTab"; import DedicatedScopesMappersTab from "../support/pages/admin-ui/manage/clients/client_details/DedicatedScopesMappersTab"; import { ClientRegistrationPage } from "../support/pages/admin-ui/manage/clients/ClientRegistrationPage"; +import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage"; let itemId = "client_crud"; const loginPage = new LoginPage(); @@ -30,6 +31,7 @@ const commonPage = new CommonPage(); const listingPage = new ListingPage(); const attributesTab = new AttributesTab(); const dedicatedScopesMappersTab = new DedicatedScopesMappersTab(); +const realmSettings = new RealmSettingsPage(); describe("Clients test", () => { const realmName = `clients-realm-${uuid()}`; @@ -880,6 +882,30 @@ describe("Clients test", () => { advancedTab.revertCompatibility(); }); + it("Client Offline Session Max", () => { + configureOfflineSessionMaxInRealmSettings(true); + + cy.findByTestId("token-lifespan-clientOfflineSessionMax").should("exist"); + + configureOfflineSessionMaxInRealmSettings(false); + + cy.findByTestId("token-lifespan-clientOfflineSessionMax").should( + "not.exist", + ); + + function configureOfflineSessionMaxInRealmSettings(enabled: boolean) { + commonPage.sidebar().goToRealmSettings(); + realmSettings.goToSessionsTab(); + realmSettings.setOfflineSessionMaxSwitch(enabled); + realmSettings.saveSessions(); + + commonPage.sidebar().goToClients(); + commonPage.tableToolbarUtils().searchItem(client); + commonPage.tableUtils().clickRowItemLink(client); + clientDetailsPage.goToAdvancedTab(); + } + }); + it("Advanced settings", () => { advancedTab.jumpToAdvanced(); 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 d947606805..4608950d85 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 @@ -14,6 +14,7 @@ export default class RealmSettingsPage extends CommonPage { generalSaveBtn = "realmSettingsGeneralTab-save"; generalRevertBtn = "realmSettingsGeneralTab-revert"; themesSaveBtn = "themes-tab-save"; + sessionsSaveBtn = "sessions-tab-save"; loginTab = "rs-login-tab"; emailTab = "rs-email-tab"; themesTab = "rs-themes-tab"; @@ -402,6 +403,12 @@ export default class RealmSettingsPage extends CommonPage { return this; } + saveSessions() { + cy.findByTestId(this.sessionsSaveBtn).click(); + + return this; + } + addSenderEmail(senderEmail: string) { this.getFromInput().clear(); @@ -710,6 +717,11 @@ export default class RealmSettingsPage extends CommonPage { return this; } + setOfflineSessionMaxSwitch(value: boolean) { + this.setSwitch(this.offlineSessionMaxSwitch, value); + return this; + } + clickAdd() { cy.findByTestId("addEventTypeConfirm").click(); return this; diff --git a/js/apps/admin-ui/src/clients/advanced/AdvancedSettings.tsx b/js/apps/admin-ui/src/clients/advanced/AdvancedSettings.tsx index 92682aa2d6..aacf243394 100644 --- a/js/apps/admin-ui/src/clients/advanced/AdvancedSettings.tsx +++ b/js/apps/admin-ui/src/clients/advanced/AdvancedSettings.tsx @@ -111,6 +111,21 @@ export const AdvancedSettings = ({ defaultValue={realm?.offlineSessionIdleTimeout} units={["minute", "day", "hour"]} /> + + {realm?.offlineSessionMaxLifespanEnabled && ( + + )} ( "attributes.tls.client.certificate.bound.access.tokens", diff --git a/js/apps/admin-ui/src/clients/advanced/TokenLifespan.tsx b/js/apps/admin-ui/src/clients/advanced/TokenLifespan.tsx index 5ca11114e2..1434737388 100644 --- a/js/apps/admin-ui/src/clients/advanced/TokenLifespan.tsx +++ b/js/apps/admin-ui/src/clients/advanced/TokenLifespan.tsx @@ -51,6 +51,7 @@ export const TokenLifespan = ({ label={t(id)} fieldId={id} labelIcon={} + data-testid={`token-lifespan-${id}`} >