2021-12-06 10:50:29 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
|
|
|
import Masthead from "../support/pages/admin_console/Masthead";
|
|
|
|
import ListingPage from "../support/pages/admin_console/ListingPage";
|
|
|
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
|
|
|
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";
|
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,
|
|
|
|
});
|
2022-02-02 11:44:52 +00:00
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(samlClientName);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
sidebarPage.goToClients();
|
|
|
|
listingPage.searchItem(samlClientName).goToItemDetails(samlClientName);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should display the saml sections on details screen", () => {
|
|
|
|
cy.get(".pf-c-jump-links__list").should(($ul) => {
|
|
|
|
expect($ul)
|
|
|
|
.to.contain("SAML capabilities")
|
|
|
|
.to.contain("Signature and Encryption");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should save force name id format", () => {
|
|
|
|
cy.get(".pf-c-jump-links__list").contains("SAML capabilities").click();
|
|
|
|
|
|
|
|
cy.findByTestId("forceNameIdFormat").click({
|
|
|
|
force: true,
|
|
|
|
});
|
|
|
|
cy.findByTestId("settingsSave").click();
|
|
|
|
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",
|
|
|
|
});
|
2022-02-02 11:44:52 +00:00
|
|
|
keycloakBefore();
|
|
|
|
loginPage.logIn();
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
2022-02-24 10:31:46 +00:00
|
|
|
adminClient.deleteClient(clientId);
|
2021-12-06 10:50:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
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 });
|
|
|
|
|
2022-08-12 10:52:41 +00:00
|
|
|
cy.findByTestId("generate").click();
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"New key pair and certificate generated successfully"
|
|
|
|
);
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
|
|
|
|
cy.findByTestId("clientSignature").click({ force: true });
|
2021-12-06 10:50:29 +00:00
|
|
|
modalUtils
|
|
|
|
.checkModalTitle('Disable "Client signature required"')
|
|
|
|
.cancelModal();
|
|
|
|
|
|
|
|
cy.findAllByTestId("certificate").should("have.length", 1);
|
|
|
|
});
|
|
|
|
|
2022-08-12 10:52:41 +00:00
|
|
|
// https://github.com/keycloak/keycloak-admin-ui/issues/3092
|
|
|
|
it.skip("should disable client signature", () => {
|
2022-02-02 11:44:52 +00:00
|
|
|
cy.intercept(
|
2022-03-06 15:25:37 +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(
|
|
|
|
"New key pair and certificate generated successfully"
|
|
|
|
);
|
|
|
|
|
|
|
|
modalUtils.confirmModal();
|
|
|
|
cy.findAllByTestId("certificate").should("have.length", 1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|