2023-01-26 09:31:07 +00:00
|
|
|
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
|
2021-08-09 19:28:24 +00:00
|
|
|
import {
|
|
|
|
ActionGroup,
|
|
|
|
Button,
|
|
|
|
FormGroup,
|
|
|
|
NumberInput,
|
|
|
|
PageSection,
|
|
|
|
Select,
|
|
|
|
SelectOption,
|
|
|
|
SelectVariant,
|
|
|
|
Switch,
|
|
|
|
Text,
|
|
|
|
TextVariants,
|
|
|
|
} from "@patternfly/react-core";
|
2023-01-26 09:31:07 +00:00
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
import { Controller, useForm, useWatch } from "react-hook-form";
|
|
|
|
import { useTranslation } from "react-i18next";
|
2021-08-09 19:28:24 +00:00
|
|
|
|
2023-05-24 12:11:06 +00:00
|
|
|
import { FormAccess } from "../components/form/FormAccess";
|
2023-03-07 09:29:40 +00:00
|
|
|
import { HelpItem } from "ui-shared";
|
2023-01-18 11:09:52 +00:00
|
|
|
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
|
2023-01-26 09:31:07 +00:00
|
|
|
import { FormPanel } from "../components/scroll-form/FormPanel";
|
2022-03-07 13:49:38 +00:00
|
|
|
import {
|
|
|
|
TimeSelector,
|
|
|
|
toHumanFormat,
|
|
|
|
} from "../components/time-selector/TimeSelector";
|
2021-08-09 19:28:24 +00:00
|
|
|
import { useServerInfo } from "../context/server-info/ServerInfoProvider";
|
2022-03-07 13:49:38 +00:00
|
|
|
import { useWhoAmI } from "../context/whoami/WhoAmI";
|
2023-03-23 15:27:51 +00:00
|
|
|
import { convertToFormValues, sortProviders } from "../util";
|
2023-10-24 08:09:26 +00:00
|
|
|
import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled";
|
2021-08-09 19:28:24 +00:00
|
|
|
|
2023-01-26 09:31:07 +00:00
|
|
|
import "./realm-settings-section.css";
|
|
|
|
|
2021-08-09 19:28:24 +00:00
|
|
|
type RealmSettingsSessionsTabProps = {
|
2021-08-23 19:00:42 +00:00
|
|
|
realm: RealmRepresentation;
|
2021-09-02 20:14:43 +00:00
|
|
|
save: (realm: RealmRepresentation) => void;
|
2021-08-09 19:28:24 +00:00
|
|
|
reset?: () => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const RealmSettingsTokensTab = ({
|
2021-09-02 20:14:43 +00:00
|
|
|
realm,
|
2021-08-09 19:28:24 +00:00
|
|
|
reset,
|
2021-09-02 20:14:43 +00:00
|
|
|
save,
|
2021-08-09 19:28:24 +00:00
|
|
|
}: RealmSettingsSessionsTabProps) => {
|
2023-09-08 13:17:17 +00:00
|
|
|
const { t } = useTranslation();
|
2021-08-09 19:28:24 +00:00
|
|
|
const serverInfo = useServerInfo();
|
2023-10-24 08:09:26 +00:00
|
|
|
const isFeatureEnabled = useIsFeatureEnabled();
|
2022-03-07 13:49:38 +00:00
|
|
|
const { whoAmI } = useWhoAmI();
|
2021-08-09 19:28:24 +00:00
|
|
|
|
|
|
|
const [defaultSigAlgDrpdwnIsOpen, setDefaultSigAlgDrpdwnOpen] =
|
|
|
|
useState(false);
|
|
|
|
|
2023-03-23 15:27:51 +00:00
|
|
|
const defaultSigAlgOptions = sortProviders(
|
2023-07-11 14:03:21 +00:00
|
|
|
serverInfo.providers!["signature"].providers,
|
2021-08-09 19:28:24 +00:00
|
|
|
);
|
|
|
|
|
2023-01-26 09:31:07 +00:00
|
|
|
const form = useForm<RealmRepresentation>();
|
2022-06-15 12:57:39 +00:00
|
|
|
const { setValue, control } = form;
|
2021-08-09 19:28:24 +00:00
|
|
|
|
|
|
|
const offlineSessionMaxEnabled = useWatch({
|
|
|
|
control,
|
|
|
|
name: "offlineSessionMaxLifespanEnabled",
|
2021-12-14 14:56:36 +00:00
|
|
|
defaultValue: realm.offlineSessionMaxLifespanEnabled,
|
2021-08-09 19:28:24 +00:00
|
|
|
});
|
|
|
|
|
2022-03-10 10:47:04 +00:00
|
|
|
const ssoSessionIdleTimeout = useWatch({
|
|
|
|
control,
|
|
|
|
name: "ssoSessionIdleTimeout",
|
|
|
|
defaultValue: 36000,
|
|
|
|
});
|
|
|
|
|
2022-03-14 10:26:06 +00:00
|
|
|
const revokeRefreshToken = useWatch({
|
|
|
|
control,
|
|
|
|
name: "revokeRefreshToken",
|
|
|
|
defaultValue: false,
|
|
|
|
});
|
|
|
|
|
2022-06-15 12:57:39 +00:00
|
|
|
useEffect(() => {
|
|
|
|
convertToFormValues(realm, setValue);
|
|
|
|
}, []);
|
|
|
|
|
2021-08-09 19:28:24 +00:00
|
|
|
return (
|
2021-08-26 12:15:28 +00:00
|
|
|
<PageSection variant="light">
|
2023-09-25 07:06:56 +00:00
|
|
|
<FormPanel title={t("general")} className="kc-sso-session-template">
|
2021-08-26 12:15:28 +00:00
|
|
|
<FormAccess
|
|
|
|
isHorizontal
|
|
|
|
role="manage-realm"
|
|
|
|
onSubmit={form.handleSubmit(save)}
|
2021-08-09 19:28:24 +00:00
|
|
|
>
|
2021-08-26 12:15:28 +00:00
|
|
|
<FormGroup
|
|
|
|
label={t("defaultSigAlg")}
|
|
|
|
fieldId="kc-default-signature-algorithm"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("defaultSigAlgHelp")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="algorithm"
|
2021-08-26 12:15:28 +00:00
|
|
|
/>
|
|
|
|
}
|
2021-08-09 19:28:24 +00:00
|
|
|
>
|
2021-08-26 12:15:28 +00:00
|
|
|
<Controller
|
|
|
|
name="defaultSignatureAlgorithm"
|
|
|
|
defaultValue={"RS256"}
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<Select
|
|
|
|
toggleId="kc-default-sig-alg"
|
|
|
|
onToggle={() =>
|
|
|
|
setDefaultSigAlgDrpdwnOpen(!defaultSigAlgDrpdwnIsOpen)
|
|
|
|
}
|
|
|
|
onSelect={(_, value) => {
|
2023-01-26 09:31:07 +00:00
|
|
|
field.onChange(value.toString());
|
2021-08-26 12:15:28 +00:00
|
|
|
setDefaultSigAlgDrpdwnOpen(false);
|
|
|
|
}}
|
2023-01-26 09:31:07 +00:00
|
|
|
selections={[field.value?.toString()]}
|
2021-08-26 12:15:28 +00:00
|
|
|
variant={SelectVariant.single}
|
|
|
|
aria-label={t("defaultSigAlg")}
|
|
|
|
isOpen={defaultSigAlgDrpdwnIsOpen}
|
|
|
|
data-testid="select-default-sig-alg"
|
|
|
|
>
|
|
|
|
{defaultSigAlgOptions!.map((p, idx) => (
|
|
|
|
<SelectOption
|
2023-01-26 09:31:07 +00:00
|
|
|
selected={p === field.value}
|
2021-08-26 12:15:28 +00:00
|
|
|
key={`default-sig-alg-${idx}`}
|
|
|
|
value={p}
|
|
|
|
></SelectOption>
|
|
|
|
))}
|
|
|
|
</Select>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2023-01-18 11:09:52 +00:00
|
|
|
|
2023-10-24 08:09:26 +00:00
|
|
|
{isFeatureEnabled(Feature.DeviceFlow) && (
|
|
|
|
<>
|
|
|
|
<FormGroup
|
|
|
|
label={t("oAuthDeviceCodeLifespan")}
|
|
|
|
fieldId="oAuthDeviceCodeLifespan"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
|
|
|
helpText={t("oAuthDeviceCodeLifespanHelp")}
|
|
|
|
fieldLabelId="oAuthDeviceCodeLifespan"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="oauth2DeviceCodeLifespan"
|
|
|
|
defaultValue={0}
|
|
|
|
control={form.control}
|
|
|
|
render={({ field }) => (
|
|
|
|
<TimeSelector
|
|
|
|
id="oAuthDeviceCodeLifespan"
|
|
|
|
data-testid="oAuthDeviceCodeLifespan"
|
|
|
|
value={field.value || 0}
|
|
|
|
onChange={field.onChange}
|
|
|
|
units={["minute", "hour", "day"]}
|
|
|
|
/>
|
|
|
|
)}
|
2023-02-01 17:19:04 +00:00
|
|
|
/>
|
2023-10-24 08:09:26 +00:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("oAuthDevicePollingInterval")}
|
|
|
|
fieldId="oAuthDevicePollingInterval"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
|
|
|
helpText={t("oAuthDevicePollingIntervalHelp")}
|
|
|
|
fieldLabelId="oAuthDevicePollingInterval"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="oauth2DevicePollingInterval"
|
|
|
|
defaultValue={0}
|
|
|
|
control={form.control}
|
|
|
|
render={({ field }) => (
|
|
|
|
<NumberInput
|
|
|
|
id="oAuthDevicePollingInterval"
|
|
|
|
value={field.value}
|
|
|
|
min={0}
|
|
|
|
onPlus={() => field.onChange(field.value || 0 + 1)}
|
|
|
|
onMinus={() => field.onChange(field.value || 0 - 1)}
|
|
|
|
onChange={(event) => {
|
|
|
|
const newValue = Number(event.currentTarget.value);
|
|
|
|
field.onChange(!isNaN(newValue) ? newValue : 0);
|
|
|
|
}}
|
|
|
|
placeholder={t("oAuthDevicePollingInterval")}
|
|
|
|
/>
|
|
|
|
)}
|
2023-01-18 11:09:52 +00:00
|
|
|
/>
|
2023-10-24 08:09:26 +00:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("shortVerificationUri")}
|
|
|
|
fieldId="shortVerificationUri"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
|
|
|
helpText={t("shortVerificationUriTooltipHelp")}
|
|
|
|
fieldLabelId="shortVerificationUri"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<KeycloakTextInput
|
|
|
|
id="shortVerificationUri"
|
|
|
|
placeholder={t("shortVerificationUri")}
|
|
|
|
{...form.register("attributes.shortVerificationUri")}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
</>
|
|
|
|
)}
|
2021-08-26 12:15:28 +00:00
|
|
|
</FormAccess>
|
|
|
|
</FormPanel>
|
|
|
|
<FormPanel
|
2023-09-25 07:06:56 +00:00
|
|
|
title={t("refreshTokens")}
|
2021-08-26 12:15:28 +00:00
|
|
|
className="kc-client-session-template"
|
|
|
|
>
|
|
|
|
<FormAccess
|
|
|
|
isHorizontal
|
|
|
|
role="manage-realm"
|
|
|
|
className="pf-u-mt-lg"
|
|
|
|
onSubmit={form.handleSubmit(save)}
|
|
|
|
>
|
|
|
|
<FormGroup
|
|
|
|
hasNoPaddingTop
|
|
|
|
label={t("revokeRefreshToken")}
|
|
|
|
fieldId="kc-revoke-refresh-token"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("revokeRefreshTokenHelp")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="revokeRefreshToken"
|
2021-08-26 12:15:28 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="revokeRefreshToken"
|
|
|
|
control={form.control}
|
|
|
|
defaultValue={false}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<Switch
|
|
|
|
id="kc-revoke-refresh-token"
|
|
|
|
data-testid="revoke-refresh-token-switch"
|
2022-08-30 13:07:51 +00:00
|
|
|
aria-label={t("revokeRefreshToken")}
|
2023-09-14 09:01:15 +00:00
|
|
|
label={t("enabled")}
|
|
|
|
labelOff={t("disabled")}
|
2023-01-26 09:31:07 +00:00
|
|
|
isChecked={field.value}
|
|
|
|
onChange={field.onChange}
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2022-03-14 10:26:06 +00:00
|
|
|
{revokeRefreshToken && (
|
|
|
|
<FormGroup
|
|
|
|
label={t("refreshTokenMaxReuse")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("refreshTokenMaxReuseHelp")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="refreshTokenMaxReuse"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2022-03-14 10:26:06 +00:00
|
|
|
}
|
|
|
|
fieldId="refreshTokenMaxReuse"
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="refreshTokenMaxReuse"
|
|
|
|
defaultValue={0}
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2022-03-14 10:26:06 +00:00
|
|
|
<NumberInput
|
|
|
|
type="text"
|
|
|
|
id="refreshTokenMaxReuseMs"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value}
|
|
|
|
onPlus={() => field.onChange(field.value! + 1)}
|
|
|
|
onMinus={() => field.onChange(field.value! - 1)}
|
2022-03-14 10:26:06 +00:00
|
|
|
onChange={(event) =>
|
2023-01-26 09:31:07 +00:00
|
|
|
field.onChange(
|
2023-07-11 14:03:21 +00:00
|
|
|
Number((event.target as HTMLInputElement).value),
|
2023-01-26 09:31:07 +00:00
|
|
|
)
|
2022-03-14 10:26:06 +00:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
)}
|
2021-08-26 12:15:28 +00:00
|
|
|
</FormAccess>
|
|
|
|
</FormPanel>
|
|
|
|
<FormPanel
|
2023-09-25 07:06:56 +00:00
|
|
|
title={t("accessTokens")}
|
2021-08-26 12:15:28 +00:00
|
|
|
className="kc-offline-session-template"
|
|
|
|
>
|
|
|
|
<FormAccess
|
|
|
|
isHorizontal
|
|
|
|
role="manage-realm"
|
|
|
|
className="pf-u-mt-lg"
|
|
|
|
onSubmit={form.handleSubmit(save)}
|
|
|
|
>
|
|
|
|
<FormGroup
|
|
|
|
label={t("accessTokenLifespan")}
|
|
|
|
fieldId="accessTokenLifespan"
|
2022-03-07 13:49:38 +00:00
|
|
|
helperText={t("recommendedSsoTimeout", {
|
2022-03-10 10:47:04 +00:00
|
|
|
time: toHumanFormat(ssoSessionIdleTimeout!, whoAmI.getLocale()),
|
2022-03-07 13:49:38 +00:00
|
|
|
})}
|
2021-08-26 12:15:28 +00:00
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("accessTokenLifespanHelp")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="accessTokenLifespan"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="accessTokenLifespan"
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
validated={
|
2023-01-26 09:31:07 +00:00
|
|
|
field.value! > ssoSessionIdleTimeout!
|
|
|
|
? "warning"
|
|
|
|
: "default"
|
2021-08-26 12:15:28 +00:00
|
|
|
}
|
|
|
|
className="kc-access-token-lifespan"
|
|
|
|
data-testid="access-token-lifespan-input"
|
|
|
|
aria-label="access-token-lifespan"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value!}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup
|
|
|
|
label={t("accessTokenLifespanImplicitFlow")}
|
|
|
|
fieldId="accessTokenLifespanImplicitFlow"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-20 08:52:43 +00:00
|
|
|
helpText={t("accessTokenLifespanImplicitFlow")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="accessTokenLifespanImplicitFlow"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
}
|
2021-08-09 19:28:24 +00:00
|
|
|
>
|
2021-08-26 12:15:28 +00:00
|
|
|
<Controller
|
|
|
|
name="accessTokenLifespanForImplicitFlow"
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
className="kc-access-token-lifespan-implicit"
|
|
|
|
data-testid="access-token-lifespan-implicit-input"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value!}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("clientLoginTimeout")}
|
|
|
|
fieldId="clientLoginTimeout"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("clientLoginTimeoutHelp")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="clientLoginTimeout"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="accessCodeLifespan"
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
className="kc-client-login-timeout"
|
|
|
|
data-testid="client-login-timeout-input"
|
|
|
|
aria-label="client-login-timeout"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value!}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-26 12:15:28 +00:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2021-08-09 19:28:24 +00:00
|
|
|
|
2021-08-26 12:15:28 +00:00
|
|
|
{offlineSessionMaxEnabled && (
|
2021-08-09 19:28:24 +00:00
|
|
|
<FormGroup
|
2021-08-26 12:15:28 +00:00
|
|
|
label={t("offlineSessionMax")}
|
|
|
|
fieldId="offlineSessionMax"
|
|
|
|
id="offline-session-max-label"
|
2021-08-09 19:28:24 +00:00
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("offlineSessionMaxHelp")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="offlineSessionMax"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
2021-08-26 12:15:28 +00:00
|
|
|
name="offlineSessionMaxLifespan"
|
2021-08-09 19:28:24 +00:00
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-09 19:28:24 +00:00
|
|
|
<TimeSelector
|
2021-08-26 12:15:28 +00:00
|
|
|
className="kc-offline-session-max"
|
|
|
|
data-testid="offline-session-max-input"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value!}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2021-08-26 12:15:28 +00:00
|
|
|
)}
|
|
|
|
</FormAccess>
|
|
|
|
</FormPanel>
|
|
|
|
<FormPanel
|
|
|
|
className="kc-login-settings-template"
|
|
|
|
title={t("actionTokens")}
|
|
|
|
>
|
|
|
|
<FormAccess
|
|
|
|
isHorizontal
|
|
|
|
role="manage-realm"
|
|
|
|
className="pf-u-mt-lg"
|
|
|
|
onSubmit={form.handleSubmit(save)}
|
|
|
|
>
|
|
|
|
<FormGroup
|
|
|
|
label={t("userInitiatedActionLifespan")}
|
|
|
|
id="kc-user-initiated-action-lifespan"
|
|
|
|
fieldId="userInitiatedActionLifespan"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-08 13:17:17 +00:00
|
|
|
helpText={t("userInitiatedActionLifespanHelp")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="userInitiatedActionLifespan"
|
2021-08-26 12:15:28 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="actionTokenGeneratedByUserLifespan"
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
className="kc-user-initiated-action-lifespan"
|
|
|
|
data-testid="user-initiated-action-lifespan"
|
|
|
|
aria-label="user-initiated-action-lifespan"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value!}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("defaultAdminInitiated")}
|
|
|
|
fieldId="defaultAdminInitiated"
|
|
|
|
id="default-admin-initiated-label"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2023-09-20 08:52:43 +00:00
|
|
|
helpText={t("defaultAdminInitiatedActionLifespanHelp")}
|
2023-09-25 07:06:56 +00:00
|
|
|
fieldLabelId="defaultAdminInitiated"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="actionTokenGeneratedByAdminLifespan"
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
className="kc-default-admin-initiated"
|
|
|
|
data-testid="default-admin-initated-input"
|
|
|
|
aria-label="default-admin-initated-input"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value!}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<Text
|
|
|
|
className="kc-override-action-tokens-subtitle"
|
|
|
|
component={TextVariants.h1}
|
2021-08-09 19:28:24 +00:00
|
|
|
>
|
2021-08-26 12:15:28 +00:00
|
|
|
{t("overrideActionTokens")}
|
|
|
|
</Text>
|
|
|
|
<FormGroup
|
|
|
|
label={t("emailVerification")}
|
|
|
|
fieldId="emailVerification"
|
|
|
|
id="email-verification"
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="attributes.actionTokenGeneratedByUserLifespan-verify-email"
|
2023-01-26 09:31:07 +00:00
|
|
|
defaultValue=""
|
2021-08-26 12:15:28 +00:00
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
className="kc-email-verification"
|
|
|
|
data-testid="email-verification-input"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value}
|
|
|
|
onChange={(value) => field.onChange(value.toString())}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("idpAccountEmailVerification")}
|
|
|
|
fieldId="idpAccountEmailVerification"
|
|
|
|
id="idp-acct-label"
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="attributes.actionTokenGeneratedByUserLifespan-idp-verify-account-via-email"
|
|
|
|
defaultValue={""}
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
className="kc-idp-email-verification"
|
|
|
|
data-testid="idp-email-verification-input"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("forgotPassword")}
|
|
|
|
fieldId="forgotPassword"
|
|
|
|
id="forgot-password-label"
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="attributes.actionTokenGeneratedByUserLifespan-reset-credentials"
|
|
|
|
defaultValue={""}
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
className="kc-forgot-pw"
|
|
|
|
data-testid="forgot-pw-input"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-26 12:15:28 +00:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("executeActions")}
|
|
|
|
fieldId="executeActions"
|
|
|
|
id="execute-actions"
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="attributes.actionTokenGeneratedByUserLifespan-execute-actions"
|
|
|
|
defaultValue={""}
|
|
|
|
control={form.control}
|
2023-01-26 09:31:07 +00:00
|
|
|
render={({ field }) => (
|
2021-08-26 12:15:28 +00:00
|
|
|
<TimeSelector
|
|
|
|
className="kc-execute-actions"
|
|
|
|
data-testid="execute-actions-input"
|
2023-01-26 09:31:07 +00:00
|
|
|
value={field.value}
|
|
|
|
onChange={field.onChange}
|
2022-03-07 13:49:38 +00:00
|
|
|
units={["minute", "hour", "day"]}
|
2021-08-26 12:15:28 +00:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<ActionGroup>
|
|
|
|
<Button
|
|
|
|
variant="primary"
|
|
|
|
type="submit"
|
|
|
|
data-testid="tokens-tab-save"
|
|
|
|
isDisabled={!form.formState.isDirty}
|
2021-08-09 19:28:24 +00:00
|
|
|
>
|
2023-09-14 09:01:15 +00:00
|
|
|
{t("save")}
|
2021-08-26 12:15:28 +00:00
|
|
|
</Button>
|
|
|
|
<Button variant="link" onClick={reset}>
|
2023-09-14 09:01:15 +00:00
|
|
|
{t("revert")}
|
2021-08-26 12:15:28 +00:00
|
|
|
</Button>
|
|
|
|
</ActionGroup>
|
|
|
|
</FormAccess>
|
|
|
|
</FormPanel>
|
|
|
|
</PageSection>
|
2021-08-09 19:28:24 +00:00
|
|
|
);
|
|
|
|
};
|