JKS keystore type available as default option in FIPS mode (#3986)

This commit is contained in:
Douglas Palmer 2023-01-02 07:34:51 -08:00 committed by GitHub
parent c37280b8cb
commit ec31aeee41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 18 deletions

View file

@ -1004,7 +1004,7 @@ describe("Clients test", () => {
it("Generate new keys", () => {
const keysTab = clientDetailsPage.goToKeysTab();
keysTab.clickGenerate();
keysTab.fillGenerateModal("keyname", "123", "1234").clickConfirm();
keysTab.fillGenerateModal("JKS", "keyname", "123", "1234").clickConfirm();
commonPage
.masthead()

View file

@ -4,6 +4,7 @@ export default class KeysTab extends CommonPage {
private generateBtn = "generate";
private confirmBtn = "confirm";
private useJwksUrl = "useJwksUrl";
private archiveFormat = "archiveFormat";
private keyAlias = "keyAlias";
private keyPassword = "keyPassword";
private storePassword = "storePassword";
@ -24,10 +25,13 @@ export default class KeysTab extends CommonPage {
}
fillGenerateModal(
archiveFormat: string,
keyAlias: string,
keyPassword: string,
storePassword: string
) {
cy.get("#archiveFormat").click();
cy.findAllByRole("option").contains(archiveFormat).click();
cy.findByTestId(this.keyAlias).type(keyAlias);
cy.findByTestId(this.keyPassword).type(keyPassword);
cy.findByTestId(this.storePassword).type(storePassword);

View file

@ -66,6 +66,10 @@ export const KeyForm = ({
const format = watch("format");
const { cryptoInfo } = useServerInfo();
const supportedKeystoreTypes = [
...(cryptoInfo?.supportedKeystoreTypes ?? []),
...(hasPem ? CERT_PEM : []),
];
return (
<Form className="pf-u-pt-lg">
@ -81,7 +85,7 @@ export const KeyForm = ({
>
<Controller
name="format"
defaultValue="JKS"
defaultValue={supportedKeystoreTypes[0]}
control={control}
render={({ field }) => (
<Select
@ -96,15 +100,13 @@ export const KeyForm = ({
aria-label={t("archiveFormat")}
isOpen={openArchiveFormat}
>
{cryptoInfo?.supportedKeystoreTypes
.concat(hasPem ? CERT_PEM : [])
.map((option) => (
<SelectOption
selected={option === field.value}
key={option}
value={option}
/>
))}
{supportedKeystoreTypes.map((option) => (
<SelectOption
selected={option === field.value}
key={option}
value={option}
/>
))}
</Select>
)}
/>

View file

@ -41,12 +41,6 @@ export const ImportKeyDialog = ({
const [openArchiveFormat, setOpenArchiveFormat] = useState(false);
const format = useWatch<string>({
control,
name: "keystoreFormat",
defaultValue: "JKS",
});
const baseFormats = useServerInfo().cryptoInfo?.supportedKeystoreTypes ?? [];
const formats = baseFormats.concat([
@ -55,6 +49,12 @@ export const ImportKeyDialog = ({
"JSON Web Key Set",
]);
const format = useWatch({
control,
name: "keystoreFormat",
defaultValue: formats[0],
});
return (
<Modal
variant={ModalVariant.medium}
@ -105,7 +105,7 @@ export const ImportKeyDialog = ({
<Controller
name="keystoreFormat"
control={control}
defaultValue="JKS"
defaultValue={formats[0]}
render={({ onChange, value }) => (
<Select
toggleId="archiveFormat"