2021-12-06 10:50:29 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
2022-12-07 15:28:28 +00:00
|
|
|
import Masthead from "../support/pages/admin-ui/Masthead";
|
|
|
|
import ListingPage from "../support/pages/admin-ui/ListingPage";
|
|
|
|
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
|
2021-12-06 10:50:29 +00:00
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
2022-02-24 10:31:46 +00:00
|
|
|
import adminClient from "../support/util/AdminClient";
|
2022-03-09 16:42:51 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2022-12-07 15:28:28 +00:00
|
|
|
import SettingsTab from "../support/pages/admin-ui/manage/clients/client_details/tabs/SettingsTab";
|
2021-12-06 10:50:29 +00:00
|
|
|
|
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const masthead = new Masthead();
|
|
|
|
const sidebarPage = new SidebarPage();
|
|
|
|
const listingPage = new ListingPage();
|
|
|
|
const modalUtils = new ModalUtils();
|
|
|
|
|
|
|
|
describe("Clients SAML tests", () => {
|
|
|
|
describe("SAML test", () => {
|
|
|
|
const samlClientName = "saml";
|
|
|
|
|
|
|
|
before(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.createClient({
|
2021-12-06 10:50:29 +00:00
|
|
|
protocol: "saml",
|
|
|
|
clientId: samlClientName,
|
|
|
|
publicClient: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(samlClientName);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2023-02-10 10:10:35 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
2021-12-06 10:50:29 +00:00
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(samlClientName).goToItemDetails(samlClientName);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should display the saml sections on details screen", () => {
|
2024-04-05 14:37:05 +00:00
|
|
|
cy.get(".pf-v5-c-jump-links__list").should(($ul) => {
|
2021-12-06 10:50:29 +00:00
|
|
|
expect($ul)
|
|
|
|
.to.contain("SAML capabilities")
|
|
|
|
.to.contain("Signature and Encryption");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should save force name id format", () => {
|
2024-04-05 14:37:05 +00:00
|
|
|
cy.get(".pf-v5-c-jump-links__list").contains("SAML capabilities").click();
|
2021-12-06 10:50:29 +00:00
|
|
|
|
2024-03-22 11:06:02 +00:00
|
|
|
cy.findByTestId("attributes.saml🍺force🍺post🍺binding").click({
|
2021-12-06 10:50:29 +00:00
|
|
|
force: true,
|
|
|
|
});
|
2023-05-24 12:11:06 +00:00
|
|
|
cy.findByTestId("settings-save").click();
|
2021-12-06 10:50:29 +00:00
|
|
|
masthead.checkNotificationMessage("Client successfully updated");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("SAML keys tab", () => {
|
|
|
|
const clientId = "saml-keys";
|
|
|
|
|
|
|
|
before(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.createClient({
|
2021-12-06 10:50:29 +00:00
|
|
|
clientId,
|
|
|
|
protocol: "saml",
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(clientId);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2023-02-10 10:10:35 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
2021-12-06 10:50:29 +00:00
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(clientId).goToItemDetails(clientId);
|
2022-01-31 07:20:35 +00:00
|
|
|
cy.findByTestId("keysTab").click();
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
2022-08-12 10:52:41 +00:00
|
|
|
it("should doesn't disable signature when cancel", () => {
|
2021-12-06 10:50:29 +00:00
|
|
|
cy.findByTestId("clientSignature").click({ force: true });
|
|
|
|
|
|
|
|
modalUtils
|
|
|
|
.checkModalTitle('Disable "Client signature required"')
|
|
|
|
.cancelModal();
|
|
|
|
|
|
|
|
cy.findAllByTestId("certificate").should("have.length", 1);
|
|
|
|
});
|
|
|
|
|
2022-08-19 11:57:25 +00:00
|
|
|
it("should disable client signature", () => {
|
2022-02-02 11:44:52 +00:00
|
|
|
cy.intercept(
|
2023-07-11 14:03:21 +00:00
|
|
|
"admin/realms/master/clients/*/certificates/saml.signing",
|
2022-02-02 11:44:52 +00:00
|
|
|
).as("load");
|
2021-12-06 10:50:29 +00:00
|
|
|
cy.findByTestId("clientSignature").click({ force: true });
|
|
|
|
|
|
|
|
modalUtils
|
|
|
|
.checkModalTitle('Disable "Client signature required"')
|
|
|
|
.confirmModal();
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Client successfully updated");
|
|
|
|
cy.findAllByTestId("certificate").should("have.length", 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should enable Encryption keys config", () => {
|
|
|
|
cy.findByTestId("encryptAssertions").click({ force: true });
|
|
|
|
|
|
|
|
cy.findByTestId("generate").click();
|
|
|
|
masthead.checkNotificationMessage(
|
2023-07-11 14:03:21 +00:00
|
|
|
"New key pair and certificate generated successfully",
|
2021-12-06 10:50:29 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
cy.findAllByTestId("certificate").should("have.length", 1);
|
|
|
|
});
|
|
|
|
});
|
2022-11-10 13:40:37 +00:00
|
|
|
|
|
|
|
describe("SAML settings tab", () => {
|
|
|
|
const clientId = "saml-settings";
|
|
|
|
const settingsTab = new SettingsTab();
|
|
|
|
|
|
|
|
before(() => {
|
|
|
|
adminClient.createClient({
|
|
|
|
clientId,
|
|
|
|
protocol: "saml",
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
|
|
|
adminClient.deleteClient(clientId);
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2023-02-10 10:10:35 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
2022-11-10 13:40:37 +00:00
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(clientId).goToItemDetails(clientId);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should check SAML capabilities", () => {
|
2024-04-05 14:37:05 +00:00
|
|
|
cy.get(".pf-v5-c-jump-links__list").contains("SAML capabilities").click();
|
2022-11-10 13:40:37 +00:00
|
|
|
|
|
|
|
settingsTab.assertNameIdFormatDropdown();
|
|
|
|
settingsTab.assertSAMLCapabilitiesSwitches();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should check signature and encryption", () => {
|
2024-04-05 14:37:05 +00:00
|
|
|
cy.get(".pf-v5-c-jump-links__list")
|
2022-11-10 13:40:37 +00:00
|
|
|
.contains("Signature and Encryption")
|
|
|
|
.click();
|
|
|
|
|
|
|
|
settingsTab.assertSignatureAlgorithmDropdown();
|
|
|
|
settingsTab.assertSignatureKeyNameDropdown();
|
|
|
|
settingsTab.assertCanonicalizationDropdown();
|
|
|
|
|
|
|
|
settingsTab.assertSignatureEncryptionSwitches();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should check access settings", () => {
|
2024-04-05 14:37:05 +00:00
|
|
|
cy.get(".pf-v5-c-jump-links__list").contains("Access settings").click();
|
2022-11-10 13:40:37 +00:00
|
|
|
|
|
|
|
const validUrl =
|
|
|
|
"http://localhost:8180/realms/master/protocol/" +
|
|
|
|
clientId +
|
|
|
|
"/clients/";
|
2024-07-10 14:20:26 +00:00
|
|
|
const invalidUrlError = "Client could not be updated: invalid_input";
|
2022-11-10 13:40:37 +00:00
|
|
|
|
2024-03-05 17:02:07 +00:00
|
|
|
cy.findByTestId("rootUrl").type("Invalid URL");
|
2022-11-10 13:40:37 +00:00
|
|
|
settingsTab.clickSaveBtn();
|
2024-07-10 14:20:26 +00:00
|
|
|
masthead.checkNotificationMessage(invalidUrlError);
|
2024-03-05 17:02:07 +00:00
|
|
|
cy.findByTestId("rootUrl").clear();
|
2022-11-10 13:40:37 +00:00
|
|
|
|
2024-03-05 17:02:07 +00:00
|
|
|
cy.findByTestId("baseUrl").type("Invalid URL");
|
2022-11-10 13:40:37 +00:00
|
|
|
settingsTab.clickSaveBtn();
|
2024-07-10 14:20:26 +00:00
|
|
|
masthead.checkNotificationMessage(invalidUrlError);
|
2024-03-05 17:02:07 +00:00
|
|
|
cy.findByTestId("baseUrl").clear();
|
2022-11-10 13:40:37 +00:00
|
|
|
|
2024-03-05 17:02:07 +00:00
|
|
|
cy.findByTestId("rootUrl").type(validUrl);
|
|
|
|
cy.findByTestId("baseUrl").type(validUrl);
|
2022-11-10 13:40:37 +00:00
|
|
|
settingsTab.clickSaveBtn();
|
|
|
|
masthead.checkNotificationMessage("Client successfully updated");
|
|
|
|
|
|
|
|
settingsTab.assertAccessSettings();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should check login settings", () => {
|
2024-04-05 14:37:05 +00:00
|
|
|
cy.get(".pf-v5-c-jump-links__list").contains("Login settings").click();
|
2022-11-10 13:40:37 +00:00
|
|
|
|
|
|
|
settingsTab.assertLoginThemeDropdown();
|
|
|
|
settingsTab.assertLoginSettings();
|
|
|
|
});
|
|
|
|
});
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|