Fix login and logout settings for SAML (#2947)

This commit is contained in:
Stan Silvert 2022-07-13 15:13:47 -04:00 committed by GitHub
parent 1dc2964757
commit 9291f3fb53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 86 deletions

View file

@ -63,7 +63,7 @@ export const ClientSettings = (props: ClientSettingsProps) => {
}, },
{ {
title: t("loginSettings"), title: t("loginSettings"),
isHidden: protocol !== "openid-connect" || client.bearerOnly, isHidden: client.bearerOnly,
panel: <LoginSettingsPanel access={client.access?.configure} />, panel: <LoginSettingsPanel access={client.access?.configure} />,
}, },
{ {

View file

@ -35,7 +35,7 @@ export const LogoutPanel = ({
isHorizontal isHorizontal
fineGrainedAccess={access?.configure} fineGrainedAccess={access?.configure}
role="manage-clients" role="manage-clients"
className="pf-u-pb-xl" className="pf-u-pb-4xl"
> >
<FormGroup <FormGroup
label={t("frontchannelLogout")} label={t("frontchannelLogout")}
@ -101,92 +101,98 @@ export const LogoutPanel = ({
/> />
</FormGroup> </FormGroup>
)} )}
<FormGroup {protocol === "openid-connect" && (
label={t("backchannelLogoutUrl")} <>
fieldId="backchannelLogoutUrl" <FormGroup
labelIcon={ label={t("backchannelLogoutUrl")}
<HelpItem fieldId="backchannelLogoutUrl"
helpText="clients-help:backchannelLogoutUrl" labelIcon={
fieldLabelId="clients:backchannelLogoutUrl" <HelpItem
/> helpText="clients-help:backchannelLogoutUrl"
} fieldLabelId="clients:backchannelLogoutUrl"
helperTextInvalid={errors.attributes?.backchannel?.logout?.url?.message} />
validated={ }
errors.attributes?.backchannel?.logout?.url?.message helperTextInvalid={
? ValidatedOptions.error errors.attributes?.backchannel?.logout?.url?.message
: ValidatedOptions.default }
} validated={
> errors.attributes?.backchannel?.logout?.url?.message
<KeycloakTextInput ? ValidatedOptions.error
type="text" : ValidatedOptions.default
id="backchannelLogoutUrl" }
name="attributes.backchannel.logout.url" >
ref={register({ <KeycloakTextInput
validate: (uri) => type="text"
((uri.startsWith("https://") || uri.startsWith("http://")) && id="backchannelLogoutUrl"
!uri.includes("*")) || name="attributes.backchannel.logout.url"
uri === "" || ref={register({
t("backchannelUrlInvalid").toString(), validate: (uri) =>
})} ((uri.startsWith("https://") || uri.startsWith("http://")) &&
validated={ !uri.includes("*")) ||
errors.attributes?.backchannel?.logout?.url?.message uri === "" ||
? ValidatedOptions.error t("backchannelUrlInvalid").toString(),
: ValidatedOptions.default })}
} validated={
/> errors.attributes?.backchannel?.logout?.url?.message
</FormGroup> ? ValidatedOptions.error
<FormGroup : ValidatedOptions.default
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
</FormGroup> label={t("backchannelLogoutSessionRequired")}
<FormGroup labelIcon={
label={t("backchannelLogoutRevokeOfflineSessions")} <HelpItem
labelIcon={ helpText="clients-help:backchannelLogoutSessionRequired"
<HelpItem fieldLabelId="clients:backchannelLogoutSessionRequired"
helpText="clients-help:backchannelLogoutRevokeOfflineSessions" />
fieldLabelId="clients:backchannelLogoutRevokeOfflineSessions" }
/> fieldId="backchannelLogoutSessionRequired"
} hasNoPaddingTop
fieldId="backchannelLogoutRevokeOfflineSessions" >
hasNoPaddingTop <Controller
> name="attributes.backchannel.logout.session.required"
<Controller defaultValue="true"
name="attributes.backchannel.logout.revoke.offline.tokens" control={control}
defaultValue="false" render={({ onChange, value }) => (
control={control} <Switch
render={({ onChange, value }) => ( id="backchannelLogoutSessionRequired"
<Switch label={t("common:on")}
id="backchannelLogoutRevokeOfflineSessions" labelOff={t("common:off")}
label={t("common:on")} isChecked={value === "true"}
labelOff={t("common:off")} onChange={(value) => onChange(value.toString())}
isChecked={value === "true"} />
onChange={(value) => onChange(value.toString())} )}
/> />
)} </FormGroup>
/> <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 <SaveReset
className="keycloak__form_actions" className="keycloak__form_actions"
name="settings" name="settings"