Combine AIA fields into XCA-style editor
This commit is contained in:
@@ -38,6 +38,11 @@ test("advanced extension list editors", async ({ page }) => {
|
||||
const vaultName = unique("List Editors");
|
||||
const certName = unique("constraints.example");
|
||||
const crlUrls = ["https://ca.example.com/root.crl", "https://backup.example.com/root.crl"];
|
||||
const aiaEntries = [
|
||||
["OCSP;URI", "https://ocsp.example.com"],
|
||||
["caIssuers;URI", "https://ca.example.com/issuer.crt"],
|
||||
];
|
||||
const aiaText = aiaEntries.map(([type, value]) => `${type}:${value}`).join(", ");
|
||||
const cpsUrls = ["https://example.com/cps", "https://example.com/policy"];
|
||||
|
||||
await login(page, user);
|
||||
@@ -79,6 +84,24 @@ test("advanced extension list editors", async ({ page }) => {
|
||||
await expect(dialog.getByLabel("Critical", { exact: true })).toBeChecked();
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
|
||||
// AIA combines the access method and XCA general-name type in each row.
|
||||
dialog = await openEditor(page, "#edit-aia", "Authority information access");
|
||||
await expect(dialog.getByLabel("Critical", { exact: true })).not.toBeChecked();
|
||||
for (const [type, value] of aiaEntries) {
|
||||
await addRow(dialog, type, value);
|
||||
}
|
||||
await dialog.getByLabel("Critical", { exact: true }).check();
|
||||
await dialog.getByRole("button", { name: "Apply", exact: true }).click();
|
||||
await expect(page.locator("#aia")).toHaveValue(aiaText);
|
||||
|
||||
dialog = await openEditor(page, "#edit-aia", "Authority information access");
|
||||
await expect(dialog.locator(".list-entry")).toHaveCount(2);
|
||||
await expect(dialog.locator(".list-entry").nth(0).locator("select")).toHaveValue("OCSP;URI");
|
||||
await expect(dialog.locator(".list-entry").nth(1).locator("select")).toHaveValue("caIssuers;URI");
|
||||
await expect(dialog.locator(".list-entry").nth(1).locator(".list-value")).toHaveValue(aiaEntries[1][1]);
|
||||
await expect(dialog.getByLabel("Critical", { exact: true })).toBeChecked();
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
|
||||
// Name constraints use typed rows and share one extension-level critical flag.
|
||||
dialog = await openEditor(page, "#edit-nc-permitted", "Name constraints · permitted");
|
||||
await expect(dialog.getByLabel("Critical", { exact: true })).toBeChecked();
|
||||
@@ -117,6 +140,7 @@ test("advanced extension list editors", async ({ page }) => {
|
||||
await expect(page.locator("#nc-excluded")).toHaveValue("DNS:.bad.example");
|
||||
await page.getByRole("button", { name: "Validate extensions" }).click();
|
||||
await expect(page.getByText("Extension preview")).toBeVisible();
|
||||
await expect(page.locator("pre.pem")).toContainText("Authority Information Access");
|
||||
await expect(page.locator("pre.pem")).toContainText("Name Constraints");
|
||||
await expect(page.locator("pre.pem")).toContainText("Certificate Policies");
|
||||
|
||||
@@ -129,6 +153,13 @@ test("advanced extension list editors", async ({ page }) => {
|
||||
}, certApiUrl);
|
||||
const extensions = detail.extension_spec;
|
||||
expect(extensions.crl_distribution_points).toEqual({ critical: true, urls: crlUrls });
|
||||
expect(extensions.authority_information_access).toEqual({
|
||||
critical: true,
|
||||
descriptions: aiaEntries.map(([type, value]) => ({
|
||||
method: type.startsWith("OCSP") ? "ocsp" : "ca_issuers",
|
||||
location: { type: "uri", value },
|
||||
})),
|
||||
});
|
||||
expect(extensions.name_constraints).toEqual({
|
||||
critical: true,
|
||||
permitted: [
|
||||
@@ -149,4 +180,9 @@ test("advanced extension list editors", async ({ page }) => {
|
||||
await addRow(dialog, "URI", "https://template.example.com/root.crl");
|
||||
await dialog.getByRole("button", { name: "Apply", exact: true }).click();
|
||||
await expect(page.locator("#crl-urls")).toHaveValue("https://template.example.com/root.crl");
|
||||
|
||||
dialog = await openEditor(page, "#edit-aia", "Authority information access");
|
||||
await addRow(dialog, "OCSP;URI", "https://template.example.com/ocsp");
|
||||
await dialog.getByRole("button", { name: "Apply", exact: true }).click();
|
||||
await expect(page.locator("#aia")).toHaveValue("OCSP;URI:https://template.example.com/ocsp");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user