mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-07 23:50:03 -05:00
Conditionally show Client Offline Session Max
Fixes: #30521
Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>
(cherry picked from commit f65af84191)
This commit is contained in:
committed by
Hynek Mlnařík
parent
601b5a7e78
commit
a091c6e2fe
@@ -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();
|
||||
|
||||
|
||||
+12
@@ -14,6 +14,7 @@ export default class RealmSettingsPage extends CommonPage {
|
||||
generalSaveBtn = "general-tab-save";
|
||||
generalRevertBtn = "general-tab-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;
|
||||
|
||||
@@ -111,6 +111,21 @@ export const AdvancedSettings = ({
|
||||
defaultValue={realm?.offlineSessionIdleTimeout}
|
||||
units={["minute", "day", "hour"]}
|
||||
/>
|
||||
|
||||
{realm?.offlineSessionMaxLifespanEnabled && (
|
||||
<TokenLifespan
|
||||
id="clientOfflineSessionMax"
|
||||
name={convertAttributeNameToForm(
|
||||
"attributes.client.offline.session.max.lifespan",
|
||||
)}
|
||||
defaultValue={
|
||||
realm?.offlineSessionMaxLifespanEnabled
|
||||
? realm.offlineSessionMaxLifespan
|
||||
: undefined
|
||||
}
|
||||
units={["minute", "day", "hour"]}
|
||||
/>
|
||||
)}
|
||||
<DefaultSwitchControl
|
||||
name={convertAttributeNameToForm<FormFields>(
|
||||
"attributes.tls.client.certificate.bound.access.tokens",
|
||||
|
||||
@@ -51,6 +51,7 @@ export const TokenLifespan = ({
|
||||
label={t(id)}
|
||||
fieldId={id}
|
||||
labelIcon={<HelpItem helpText={t(`${id}Help`)} fieldLabelId={id} />}
|
||||
data-testid={`token-lifespan-${id}`}
|
||||
>
|
||||
<Controller
|
||||
name={name}
|
||||
|
||||
Reference in New Issue
Block a user