Adds LDAP kerberos integration and synchronization tests (#2378)

This commit is contained in:
mfrances17 2022-04-06 18:06:56 -04:00 committed by GitHub
parent 525d90c234
commit 0f48da11e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 124 additions and 6 deletions

View file

@ -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);

View file

@ -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;

View file

@ -54,7 +54,8 @@ export const LdapSettingsKerberosIntegration = ({
control={form.control}
render={({ onChange, value }) => (
<Switch
id={"kc-allow-kerberos-authentication"}
id="kc-allow-kerberos-authentication"
data-testid="allow-kerberos-auth"
isDisabled={false}
onChange={(value) => onChange([`${value}`])}
isChecked={value[0] === "true"}
@ -184,7 +185,8 @@ export const LdapSettingsKerberosIntegration = ({
control={form.control}
render={({ onChange, value }) => (
<Switch
id={"kc-debug"}
id="kc-debug"
data-testid="debug"
isDisabled={false}
onChange={(value) => onChange([`${value}`])}
isChecked={value[0] === "true"}
@ -213,7 +215,8 @@ export const LdapSettingsKerberosIntegration = ({
control={form.control}
render={({ onChange, value }) => (
<Switch
id={"kc-use-kerberos-password-authentication"}
id="kc-use-kerberos-password-authentication"
data-testid="use-kerberos-pw-auth"
isDisabled={false}
onChange={(value) => onChange([`${value}`])}
isChecked={value[0] === "true"}

View file

@ -50,7 +50,8 @@ export const LdapSettingsSynchronization = ({
control={form.control}
render={({ onChange, value }) => (
<Switch
id={"kc-import-users"}
id="kc-import-users"
data-testid="import-users"
name="importEnabled"
label={t("common:on")}
labelOff={t("common:off")}
@ -75,6 +76,7 @@ export const LdapSettingsSynchronization = ({
type="number"
min={0}
id="kc-batch-size"
data-testid="batch-size"
name="config.batchSizeForSync[0]"
ref={form.register}
/>
@ -96,7 +98,8 @@ export const LdapSettingsSynchronization = ({
control={form.control}
render={({ onChange, value }) => (
<Switch
id={"kc-periodic-full-sync"}
id="kc-periodic-full-sync"
data-testid="periodic-full-sync"
isDisabled={false}
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 }) => (
<Switch
id={"kc-periodic-changed-users-sync"}
id="kc-periodic-changed-users-sync"
data-testid="periodic-changed-users-sync"
isDisabled={false}
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}
/>