diff --git a/cypress/integration/user_fed_ldap_test.spec.ts b/cypress/integration/user_fed_ldap_test.spec.ts index 624e4fa88f..1703e798fb 100644 --- a/cypress/integration/user_fed_ldap_test.spec.ts +++ b/cypress/integration/user_fed_ldap_test.spec.ts @@ -31,6 +31,16 @@ const truststoreSpiNever = "Never"; const bindDnCnOnly = "cn=read-only-admin"; const bindCredsInvalid = "not-my-password"; +// kerberos integration settings +const kerberosRealm = "FOO.ORG"; +const serverPrincipal = "HTTP/host.foo.org@FOO.ORG"; +const keyTab = "/etc/krb5.keytab"; + +// ldap synchronization settings +const batchSize = "100"; +const fullSyncPeriod = "604800"; +const userSyncPeriod = "86400"; + // ldap searching and updating const editModeReadOnly = "READ_ONLY"; const firstUsersDn = "user-dn-1"; @@ -203,6 +213,83 @@ describe("User Fed LDAP tests", () => { sidebarPage.goToUserFederation(); }); + it("Should update Kerberos integration settings and save", () => { + providersPage.clickExistingCard(firstLdapName); + + providersPage.toggleSwitch(providersPage.allowKerberosAuth); + providersPage.toggleSwitch(providersPage.debug); + providersPage.toggleSwitch(providersPage.useKerberosForPwAuth); + + providersPage.fillTextField( + providersPage.ldapKerberosRealmInput, + kerberosRealm + ); + providersPage.fillTextField( + providersPage.ldapServerPrincipalInput, + serverPrincipal + ); + providersPage.fillTextField(providersPage.ldapKeyTabInput, keyTab); + + providersPage.save(provider); + masthead.checkNotificationMessage(savedSuccessMessage); + + // now verify + sidebarPage.goToUserFederation(); + providersPage.clickExistingCard(firstLdapName); + providersPage.verifyTextField( + providersPage.ldapKerberosRealmInput, + kerberosRealm + ); + providersPage.verifyTextField( + providersPage.ldapServerPrincipalInput, + serverPrincipal + ); + providersPage.verifyTextField(providersPage.ldapKeyTabInput, keyTab); + providersPage.verifyToggle(providersPage.allowKerberosAuth, "on"); + providersPage.verifyToggle(providersPage.debug, "on"); + providersPage.verifyToggle(providersPage.useKerberosForPwAuth, "on"); + + sidebarPage.goToUserFederation(); + }); + + it("Should update Synchronization settings and save", () => { + providersPage.clickExistingCard(firstLdapName); + + providersPage.toggleSwitch(providersPage.importUsers); + providersPage.toggleSwitch(providersPage.periodicFullSync); + providersPage.toggleSwitch(providersPage.periodicUsersSync); + + providersPage.fillTextField(providersPage.ldapBatchSizeInput, batchSize); + providersPage.fillTextField( + providersPage.ldapFullSyncPeriodInput, + fullSyncPeriod + ); + providersPage.fillTextField( + providersPage.ldapUsersSyncPeriodInput, + userSyncPeriod + ); + + providersPage.save(provider); + masthead.checkNotificationMessage(savedSuccessMessage); + + // now verify + sidebarPage.goToUserFederation(); + providersPage.clickExistingCard(firstLdapName); + providersPage.verifyTextField(providersPage.ldapBatchSizeInput, batchSize); + providersPage.verifyTextField( + providersPage.ldapFullSyncPeriodInput, + fullSyncPeriod + ); + providersPage.verifyTextField( + providersPage.ldapUsersSyncPeriodInput, + userSyncPeriod + ); + providersPage.verifyToggle(providersPage.periodicFullSync, "on"); + providersPage.verifyToggle(providersPage.periodicUsersSync, "on"); + providersPage.verifyToggle(providersPage.importUsers, "on"); + sidebarPage.goToUserFederation(); + }); + it("Should update display name", () => { providersPage.clickExistingCard(firstLdapName); providersPage.fillLdapGeneralData(updatedLdapName); diff --git a/cypress/support/pages/admin_console/manage/providers/ProviderPage.ts b/cypress/support/pages/admin_console/manage/providers/ProviderPage.ts index 580f17e0d0..71dda030ec 100644 --- a/cypress/support/pages/admin_console/manage/providers/ProviderPage.ts +++ b/cypress/support/pages/admin_console/manage/providers/ProviderPage.ts @@ -31,6 +31,22 @@ export default class ProviderPage { private ldapUuidLdapAttInput = "ldap-uuid-attribute"; private ldapUserObjClassesInput = "ldap-user-object-classes"; + // LdapSettingsKerberosIntegration input values + ldapKerberosRealmInput = "kerberos-realm"; + ldapServerPrincipalInput = "kerberos-principal"; + ldapKeyTabInput = "kerberos-keytab"; + allowKerberosAuth = "allow-kerberos-auth"; + debug = "debug"; + useKerberosForPwAuth = "use-kerberos-pw-auth"; + + // LdapSettingsSynchronization input values + ldapBatchSizeInput = "batch-size"; + ldapFullSyncPeriodInput = "full-sync-period"; + ldapUsersSyncPeriodInput = "changed-users-sync-period"; + importUsers = "import-users"; + periodicFullSync = "periodic-full-sync"; + periodicUsersSync = "periodic-changed-users-sync"; + // SettingsCache input values private cacheDayInput = "#kc-eviction-day"; private cacheDayList = "#kc-eviction-day + ul"; @@ -160,6 +176,12 @@ export default class ProviderPage { return this; } + fillTextField(textField: string, value: string) { + cy.findByTestId(textField).type("x"); + cy.findByTestId(textField).clear().type(value).blur(); + return this; + } + toggleSwitch(switchName: string) { cy.findByTestId(switchName).click({ force: true }); return this; diff --git a/src/user-federation/ldap/LdapSettingsKerberosIntegration.tsx b/src/user-federation/ldap/LdapSettingsKerberosIntegration.tsx index 4e4a744c85..b812c0f87c 100644 --- a/src/user-federation/ldap/LdapSettingsKerberosIntegration.tsx +++ b/src/user-federation/ldap/LdapSettingsKerberosIntegration.tsx @@ -54,7 +54,8 @@ export const LdapSettingsKerberosIntegration = ({ control={form.control} render={({ onChange, value }) => ( onChange([`${value}`])} isChecked={value[0] === "true"} @@ -184,7 +185,8 @@ export const LdapSettingsKerberosIntegration = ({ control={form.control} render={({ onChange, value }) => ( onChange([`${value}`])} isChecked={value[0] === "true"} @@ -213,7 +215,8 @@ export const LdapSettingsKerberosIntegration = ({ control={form.control} render={({ onChange, value }) => ( onChange([`${value}`])} isChecked={value[0] === "true"} diff --git a/src/user-federation/ldap/LdapSettingsSynchronization.tsx b/src/user-federation/ldap/LdapSettingsSynchronization.tsx index 9034795eab..39f976a15d 100644 --- a/src/user-federation/ldap/LdapSettingsSynchronization.tsx +++ b/src/user-federation/ldap/LdapSettingsSynchronization.tsx @@ -50,7 +50,8 @@ export const LdapSettingsSynchronization = ({ control={form.control} render={({ onChange, value }) => ( @@ -96,7 +98,8 @@ export const LdapSettingsSynchronization = ({ control={form.control} render={({ onChange, value }) => ( onChange(value)} isChecked={value === true} @@ -124,6 +127,7 @@ export const LdapSettingsSynchronization = ({ min={-1} defaultValue={604800} id="kc-full-sync-period" + data-testid="full-sync-period" name="config.fullSyncPeriod[0]" ref={form.register} /> @@ -146,7 +150,8 @@ export const LdapSettingsSynchronization = ({ control={form.control} render={({ onChange, value }) => ( onChange(value)} isChecked={value === true} @@ -174,6 +179,7 @@ export const LdapSettingsSynchronization = ({ min={-1} defaultValue={86400} id="kc-changed-users-sync-period" + data-testid="changed-users-sync-period" name="config.changedSyncPeriod[0]" ref={form.register} />