Added missing fields (#2047)

This commit is contained in:
Erik Jan de Wit 2022-02-22 12:22:29 +01:00 committed by GitHub
parent 816d2b5221
commit 27ed3e40fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 112 additions and 11 deletions

View file

@ -10,6 +10,7 @@ import {
Select,
SelectVariant,
SelectOption,
ValidatedOptions,
} from "@patternfly/react-core";
import { Controller, useFormContext } from "react-hook-form";
@ -36,7 +37,7 @@ export const ClientSettings = ({
save,
reset,
}: ClientSettingsProps) => {
const { register, control, watch } = useFormContext<ClientForm>();
const { register, control, watch, errors } = useFormContext<ClientForm>();
const { t } = useTranslation("clients");
const [loginThemeOpen, setLoginThemeOpen] = useState(false);
@ -58,7 +59,7 @@ export const ClientSettings = ({
return [...result, "accessSettings"];
}
return [...result, "accessSettings", "loginSettings"];
return [...result, "accessSettings", "loginSettings", "logoutSettings"];
}, [protocol, client]);
return (
@ -200,20 +201,18 @@ export const ClientSettings = ({
aria-label={t("loginTheme")}
isOpen={loginThemeOpen}
>
<SelectOption key="empty" value="">
{t("common:choose")}
</SelectOption>
{/* The type for the children of Select are incorrect, so we need a fragment here. */}
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<>
{loginThemes.map((theme) => (
{[
<SelectOption key="empty" value="">
{t("common:choose")}
</SelectOption>,
...loginThemes.map((theme) => (
<SelectOption
selected={theme.name === value}
key={theme.name}
value={theme.name}
/>
))}
</>
)),
]}
</Select>
)}
/>
@ -288,6 +287,96 @@ export const ClientSettings = ({
isDisabled={!(consentRequired && displayOnConsentScreen === "true")}
/>
</FormGroup>
</FormAccess>
<FormAccess isHorizontal role="manage-clients">
<FormGroup
label={t("backchannelLogoutUrl")}
fieldId="backchannelLogoutUrl"
labelIcon={
<HelpItem
helpText="clients-help:backchannelLogoutUrl"
fieldLabelId="clients:backchannelLogoutUrl"
/>
}
helperTextInvalid={
errors.attributes?.backchannel?.logout?.url?.message
}
validated={
errors.attributes?.backchannel?.logout?.url?.message
? ValidatedOptions.error
: ValidatedOptions.default
}
>
<TextInput
type="text"
id="backchannelLogoutUrl"
name="attributes.backchannel.logout.url"
ref={register({
validate: (uri) =>
((uri.startsWith("https://") || uri.startsWith("http://")) &&
uri.indexOf("*") === -1) ||
uri === "" ||
t("backchannelUrlInvalid").toString(),
})}
validated={
errors.attributes?.backchannel?.logout?.url?.message
? ValidatedOptions.error
: ValidatedOptions.default
}
/>
</FormGroup>
<FormGroup
label={t("backchannelLogoutSessionRequired")}
labelIcon={
<HelpItem
helpText="clients-help:backchannelLogoutSessionRequired"
fieldLabelId="clients:backchannelLogoutSessionRequired"
/>
}
fieldId="backchannelLogoutSessionRequired"
hasNoPaddingTop
>
<Controller
name="attributes.backchannel.logout.session.required"
defaultValue="true"
control={control}
render={({ onChange, value }) => (
<Switch
id="backchannelLogoutSessionRequired"
label={t("common:on")}
labelOff={t("common:off")}
isChecked={value === "true"}
onChange={(value) => onChange(value.toString())}
/>
)}
/>
</FormGroup>
<FormGroup
label={t("backchannelLogoutRevokeOfflineSessions")}
labelIcon={
<HelpItem
helpText="clients-help:backchannelLogoutRevokeOfflineSessions"
fieldLabelId="clients:backchannelLogoutRevokeOfflineSessions"
/>
}
fieldId="backchannelLogoutRevokeOfflineSessions"
hasNoPaddingTop
>
<Controller
name="attributes.backchannel.logout.revoke.offline.tokens"
defaultValue="false"
control={control}
render={({ onChange, value }) => (
<Switch
id="backchannelLogoutRevokeOfflineSessions"
label={t("common:on")}
labelOff={t("common:off")}
isChecked={value === "true"}
onChange={(value) => onChange(value.toString())}
/>
)}
/>
</FormGroup>
<SaveReset
className="keycloak__form_actions"
name="settings"

View file

@ -164,6 +164,12 @@ export default {
"SAML ARTIFACT Binding URL for the client's single logout service. You can leave this blank if you are using a different binding.",
artifactBindingUrl:
"URL to send the HTTP ARTIFACT messages to. You can leave this blank if you are using a different binding. This value should be set when forcing ARTIFACT binding together with IdP initiated login.",
backchannelLogoutUrl:
"URL that will cause the client to log itself out when a logout request is sent to this realm (via end_session_endpoint). If omitted, no logout request will be sent to the client is this case.",
backchannelLogoutSessionRequired:
"Specifying whether a sid (session ID) Claim is included in the Logout Token when the Backchannel Logout URL is used.",
backchannelLogoutRevokeOfflineSessions:
'Specifying whether a "revoke_offline_access" event is included in the Logout Token when the Backchannel Logout URL is used. Keycloak will revoke offline sessions when receiving a Logout Token with this event.',
artifactResolutionService:
"SAML Artifact resolution service for the client. This is the endpoint to which Keycloak will send a SOAP ArtifactResolve message. You can leave this blank if you do not have a URL for this binding.",
authenticationOverrides: "Override realm authentication flow bindings.",

View file

@ -348,6 +348,12 @@ export default {
displayOnClient: "Display client on screen",
consentScreenText: "Client consent screen text",
loginSettings: "Login settings",
logoutSettings: "Logout settings",
backchannelLogoutUrl: "Backchannel logout URL",
backchannelUrlInvalid: "Backchannel logout URL is not a valid URL",
backchannelLogoutSessionRequired: "Backchannel logout session required",
backchannelLogoutRevokeOfflineSessions:
"Backchannel logout revoke offline sessions",
accessSettings: "Access settings",
rootUrl: "Root URL",
validRedirectUri: "Valid redirect URIs",