Added an inline Alert for Signed Jwt authenticator in Credentials #1850 (#3240)

* alert-wip

* fixed css by introducing a custom style

* fixed css by introducing a custom style

* fixed css by introducing a custom style

Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
agagancarczyk 2022-08-31 11:48:46 +01:00 committed by GitHub
parent 0622fe5480
commit 7b4da6909a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 7 deletions

View file

@ -362,9 +362,9 @@
"loginTheme": "Login theme", "loginTheme": "Login theme",
"consentRequired": "Consent required", "consentRequired": "Consent required",
"clientAuthenticator": "Client Authenticator", "clientAuthenticator": "Client Authenticator",
"changeAuthenticatorConfirmTitle": "Change to {{clientAuthenticatorType}}", "changeAuthenticatorConfirmTitle": "Change to {{clientAuthenticatorType}}?",
"changeAuthenticatorConfirm": "If you change authenticator to {{clientAuthenticatorType}}, the keycloak database will be updated and you may need to download a new adapter configuration for this client", "changeAuthenticatorConfirm": "If you change authenticator to {{clientAuthenticatorType}}, the Keycloak database will be updated and you may need to download a new adapter configuration for this client.",
"signedJWTConfirm": "You should configure JWKS URL or keys in the \"Keys\" tab to change the parameters of Signed JWT authenticator.", "signedJWTConfirm": "Generate a private key and certificate for the client from the Keys tab.",
"anyAlgorithm": "Any algorithm", "anyAlgorithm": "Any algorithm",
"clientSecret": "Client secret", "clientSecret": "Client secret",
"regenerate": "Regenerate", "regenerate": "Regenerate",

View file

@ -1,5 +1,4 @@
import { import {
Alert,
AlertVariant, AlertVariant,
ButtonVariant, ButtonVariant,
Divider, Divider,
@ -372,6 +371,7 @@ export default function ClientDetails() {
<> <>
<ConfirmDialogModal <ConfirmDialogModal
continueButtonLabel="common:yes" continueButtonLabel="common:yes"
cancelButtonLabel="common:no"
titleKey={t("changeAuthenticatorConfirmTitle", { titleKey={t("changeAuthenticatorConfirmTitle", {
clientAuthenticatorType: clientAuthenticatorType, clientAuthenticatorType: clientAuthenticatorType,
})} })}
@ -383,9 +383,6 @@ export default function ClientDetails() {
{t("changeAuthenticatorConfirm", { {t("changeAuthenticatorConfirm", {
clientAuthenticatorType: clientAuthenticatorType, clientAuthenticatorType: clientAuthenticatorType,
})} })}
{clientAuthenticatorType === "client-jwt" && (
<Alert variant="info" isInline title={t("signedJWTConfirm")} />
)}
</> </>
</ConfirmDialogModal> </ConfirmDialogModal>
<DeleteConfirm /> <DeleteConfirm />

View file

@ -2,6 +2,7 @@ import { useState } from "react";
import { Controller, useFormContext, useWatch } from "react-hook-form"; import { Controller, useFormContext, useWatch } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import {
Alert,
ActionGroup, ActionGroup,
AlertVariant, AlertVariant,
Button, Button,
@ -30,6 +31,7 @@ import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { ClientSecret } from "./ClientSecret"; import { ClientSecret } from "./ClientSecret";
import { SignedJWT } from "./SignedJWT"; import { SignedJWT } from "./SignedJWT";
import { X509 } from "./X509"; import { X509 } from "./X509";
import "./credentials.css";
type AccessToken = { type AccessToken = {
registrationAccessToken: string; registrationAccessToken: string;
@ -185,6 +187,14 @@ export const Credentials = ({ client, save, refresh }: CredentialsProps) => {
</FormGroup> </FormGroup>
{(clientAuthenticatorType === "client-jwt" || {(clientAuthenticatorType === "client-jwt" ||
clientAuthenticatorType === "client-secret-jwt") && <SignedJWT />} clientAuthenticatorType === "client-secret-jwt") && <SignedJWT />}
{clientAuthenticatorType === "client-jwt" && (
<Alert
variant="info"
isInline
className="kc-signedJWTAlert"
title={t("signedJWTConfirm")}
/>
)}
{clientAuthenticatorType === "client-x509" && <X509 />} {clientAuthenticatorType === "client-x509" && <X509 />}
<ActionGroup> <ActionGroup>
<Button variant="primary" type="submit" isDisabled={!isDirty}> <Button variant="primary" type="submit" isDisabled={!isDirty}>

View file

@ -0,0 +1,9 @@
.kc-signedJWTAlert {
margin: 0.1rem 0 0 10.4rem;
}
@media (max-width: 768px) {
.kc-signedJWTAlert {
margin: 0.5rem 0 0 0;
}
}