2022-08-03 12:12:07 +00:00
|
|
|
import { useEffect, useState } from "react";
|
2021-08-09 19:28:24 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2022-06-15 12:57:39 +00:00
|
|
|
import { Controller, useForm, useWatch } from "react-hook-form";
|
2021-08-09 19:28:24 +00:00
|
|
|
import {
|
|
|
|
ActionGroup,
|
|
|
|
Button,
|
|
|
|
FormGroup,
|
|
|
|
NumberInput,
|
|
|
|
PageSection,
|
|
|
|
Select,
|
|
|
|
SelectOption,
|
|
|
|
SelectVariant,
|
|
|
|
Switch,
|
|
|
|
Text,
|
|
|
|
TextVariants,
|
|
|
|
} from "@patternfly/react-core";
|
|
|
|
|
2021-08-26 08:39:35 +00:00
|
|
|
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
|
2021-08-09 19:28:24 +00:00
|
|
|
import { FormAccess } from "../components/form-access/FormAccess";
|
|
|
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
|
|
|
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";
|
2021-09-02 20:14:43 +00:00
|
|
|
|
2022-02-16 11:39:08 +00:00
|
|
|
import "./realm-settings-section.css";
|
2022-03-07 13:49:38 +00:00
|
|
|
import { useWhoAmI } from "../context/whoami/WhoAmI";
|
2022-06-15 12:57:39 +00:00
|
|
|
import { convertToFormValues } from "../util";
|
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) => {
|
|
|
|
const { t } = useTranslation("realm-settings");
|
|
|
|
const serverInfo = useServerInfo();
|
2022-03-07 13:49:38 +00:00
|
|
|
const { whoAmI } = useWhoAmI();
|
2021-08-09 19:28:24 +00:00
|
|
|
|
|
|
|
const [defaultSigAlgDrpdwnIsOpen, setDefaultSigAlgDrpdwnOpen] =
|
|
|
|
useState(false);
|
|
|
|
|
|
|
|
const allComponentTypes =
|
|
|
|
serverInfo.componentTypes?.["org.keycloak.keys.KeyProvider"] ?? [];
|
|
|
|
|
|
|
|
const esOptions = ["ES256", "ES384", "ES512"];
|
|
|
|
|
|
|
|
const hmacAlgorithmOptions = allComponentTypes[2].properties[4].options;
|
|
|
|
|
|
|
|
const javaKeystoreAlgOptions = allComponentTypes[3].properties[3].options;
|
|
|
|
|
|
|
|
const defaultSigAlgOptions = esOptions.concat(
|
|
|
|
hmacAlgorithmOptions!,
|
|
|
|
javaKeystoreAlgOptions!
|
|
|
|
);
|
|
|
|
|
2022-06-15 12:57:39 +00:00
|
|
|
const form = useForm<RealmRepresentation>({ shouldUnregister: false });
|
|
|
|
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">
|
|
|
|
<FormPanel
|
|
|
|
title={t("realm-settings:general")}
|
|
|
|
className="kc-sso-session-template"
|
|
|
|
>
|
|
|
|
<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
|
|
|
|
helpText="realm-settings-help:defaultSigAlg"
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId="realm-settings: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}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Select
|
|
|
|
toggleId="kc-default-sig-alg"
|
|
|
|
onToggle={() =>
|
|
|
|
setDefaultSigAlgDrpdwnOpen(!defaultSigAlgDrpdwnIsOpen)
|
|
|
|
}
|
|
|
|
onSelect={(_, value) => {
|
|
|
|
onChange(value.toString());
|
|
|
|
setDefaultSigAlgDrpdwnOpen(false);
|
|
|
|
}}
|
|
|
|
selections={[value.toString()]}
|
|
|
|
variant={SelectVariant.single}
|
|
|
|
aria-label={t("defaultSigAlg")}
|
|
|
|
isOpen={defaultSigAlgDrpdwnIsOpen}
|
|
|
|
data-testid="select-default-sig-alg"
|
|
|
|
>
|
|
|
|
{defaultSigAlgOptions!.map((p, idx) => (
|
|
|
|
<SelectOption
|
|
|
|
selected={p === value}
|
|
|
|
key={`default-sig-alg-${idx}`}
|
|
|
|
value={p}
|
|
|
|
></SelectOption>
|
|
|
|
))}
|
|
|
|
</Select>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
</FormAccess>
|
|
|
|
</FormPanel>
|
|
|
|
<FormPanel
|
|
|
|
title={t("realm-settings:refreshTokens")}
|
|
|
|
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
|
|
|
|
helpText="realm-settings-help:revokeRefreshToken"
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId="realm-settings:revokeRefreshToken"
|
2021-08-26 12:15:28 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="revokeRefreshToken"
|
|
|
|
control={form.control}
|
|
|
|
defaultValue={false}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
|
|
|
id="kc-revoke-refresh-token"
|
|
|
|
data-testid="revoke-refresh-token-switch"
|
|
|
|
aria-label="revoke-refresh-token-switch"
|
|
|
|
label={t("common:enabled")}
|
|
|
|
labelOff={t("common:disabled")}
|
|
|
|
isChecked={value}
|
|
|
|
onChange={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
|
|
|
|
helpText="realm-settings-help:refreshTokenMaxReuse"
|
|
|
|
fieldLabelId="realm-settings: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}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<NumberInput
|
|
|
|
type="text"
|
|
|
|
id="refreshTokenMaxReuseMs"
|
|
|
|
value={value}
|
|
|
|
onPlus={() => onChange(value + 1)}
|
|
|
|
onMinus={() => onChange(value - 1)}
|
|
|
|
onChange={(event) =>
|
|
|
|
onChange(Number((event.target as HTMLInputElement).value))
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
)}
|
2021-08-26 12:15:28 +00:00
|
|
|
</FormAccess>
|
|
|
|
</FormPanel>
|
|
|
|
<FormPanel
|
|
|
|
title={t("realm-settings:accessTokens")}
|
|
|
|
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
|
|
|
|
helpText="realm-settings-help:accessTokenLifespan"
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId="realm-settings:accessTokenLifespan"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="accessTokenLifespan"
|
|
|
|
defaultValue=""
|
|
|
|
helperTextInvalid={t("common:required")}
|
|
|
|
control={form.control}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
validated={
|
2022-03-10 10:47:04 +00:00
|
|
|
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"
|
|
|
|
value={value}
|
|
|
|
onChange={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
|
|
|
|
helpText="realm-settings-help:accessTokenLifespanImplicitFlow"
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId="realm-settings: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"
|
|
|
|
defaultValue=""
|
|
|
|
control={form.control}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
className="kc-access-token-lifespan-implicit"
|
|
|
|
data-testid="access-token-lifespan-implicit-input"
|
|
|
|
aria-label="access-token-lifespan-implicit"
|
|
|
|
value={value}
|
|
|
|
onChange={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
|
|
|
|
helpText="realm-settings-help:clientLoginTimeout"
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId="realm-settings:clientLoginTimeout"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="accessCodeLifespan"
|
|
|
|
defaultValue=""
|
|
|
|
control={form.control}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
className="kc-client-login-timeout"
|
|
|
|
data-testid="client-login-timeout-input"
|
|
|
|
aria-label="client-login-timeout"
|
|
|
|
value={value}
|
|
|
|
onChange={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
|
2021-08-26 12:15:28 +00:00
|
|
|
helpText="realm-settings-help:offlineSessionMax"
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId="realm-settings: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
|
|
|
defaultValue=""
|
|
|
|
control={form.control}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
2021-08-26 12:15:28 +00:00
|
|
|
className="kc-offline-session-max"
|
|
|
|
data-testid="offline-session-max-input"
|
|
|
|
aria-label="offline-session-max-input"
|
2021-08-09 19:28:24 +00:00
|
|
|
value={value}
|
|
|
|
onChange={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
|
|
|
|
helpText="realm-settings-help:userInitiatedActionLifespan"
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId="realm-settings:userInitiatedActionLifespan"
|
2021-08-26 12:15:28 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="actionTokenGeneratedByUserLifespan"
|
|
|
|
defaultValue={""}
|
|
|
|
control={form.control}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
className="kc-user-initiated-action-lifespan"
|
|
|
|
data-testid="user-initiated-action-lifespan"
|
|
|
|
aria-label="user-initiated-action-lifespan"
|
|
|
|
value={value}
|
|
|
|
onChange={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
|
|
|
|
helpText="realm-settings-help:defaultAdminInitiatedActionLifespan"
|
2021-12-14 14:56:36 +00:00
|
|
|
fieldLabelId="realm-settings:defaultAdminInitiated"
|
2021-08-09 19:28:24 +00:00
|
|
|
/>
|
2021-08-26 12:15:28 +00:00
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="actionTokenGeneratedByAdminLifespan"
|
|
|
|
defaultValue={""}
|
|
|
|
control={form.control}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
className="kc-default-admin-initiated"
|
|
|
|
data-testid="default-admin-initated-input"
|
|
|
|
aria-label="default-admin-initated-input"
|
|
|
|
value={value}
|
|
|
|
onChange={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"
|
|
|
|
defaultValue={""}
|
|
|
|
control={form.control}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
className="kc-email-verification"
|
|
|
|
data-testid="email-verification-input"
|
|
|
|
aria-label="email-verification-input"
|
|
|
|
value={value}
|
|
|
|
onChange={(value: any) => 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}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
className="kc-idp-email-verification"
|
|
|
|
data-testid="idp-email-verification-input"
|
|
|
|
aria-label="idp-email-verification"
|
|
|
|
value={value}
|
|
|
|
onChange={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}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
className="kc-forgot-pw"
|
|
|
|
data-testid="forgot-pw-input"
|
|
|
|
aria-label="forgot-pw-input"
|
|
|
|
value={value}
|
|
|
|
onChange={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}
|
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<TimeSelector
|
|
|
|
className="kc-execute-actions"
|
|
|
|
data-testid="execute-actions-input"
|
|
|
|
aria-label="execute-actions-input"
|
|
|
|
value={value}
|
|
|
|
onChange={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
|
|
|
>
|
2021-08-26 12:15:28 +00:00
|
|
|
{t("common:save")}
|
|
|
|
</Button>
|
|
|
|
<Button variant="link" onClick={reset}>
|
|
|
|
{t("common:revert")}
|
|
|
|
</Button>
|
|
|
|
</ActionGroup>
|
|
|
|
</FormAccess>
|
|
|
|
</FormPanel>
|
|
|
|
</PageSection>
|
2021-08-09 19:28:24 +00:00
|
|
|
);
|
|
|
|
};
|