Add application URLs to SAML advanced tab (#3075)

This commit is contained in:
Erik Jan de Wit 2022-08-12 15:13:49 +02:00 committed by GitHub
parent 6a881d71b2
commit 63b8f08be0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 56 deletions

View file

@ -0,0 +1,71 @@
import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form";
import { FormGroup } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { convertAttributeNameToForm } from "../../util";
export const ApplicationUrls = () => {
const { t } = useTranslation("clients");
const { register } = useFormContext();
return (
<>
<FormGroup
label={t("logoUrl")}
fieldId="logoUrl"
labelIcon={
<HelpItem
helpText="clients-help:logoUrl"
fieldLabelId="clients:logoUrl"
/>
}
>
<KeycloakTextInput
type="text"
id="logoUrl"
name={convertAttributeNameToForm("attributes.logoUri")}
data-testid="logoUrl"
ref={register}
/>
</FormGroup>
<FormGroup
label={t("policyUrl")}
fieldId="policyUrl"
labelIcon={
<HelpItem
helpText="clients-help:policyUrl"
fieldLabelId="clients:policyUrl"
/>
}
>
<KeycloakTextInput
type="text"
id="policyUrl"
name={convertAttributeNameToForm("attributes.policyUri")}
data-testid="policyUrl"
ref={register}
/>
</FormGroup>
<FormGroup
label={t("termsOfServiceUrl")}
fieldId="termsOfServiceUrl"
labelIcon={
<HelpItem
helpText="clients-help:termsOfServiceUrl"
fieldLabelId="clients:termsOfServiceUrl"
/>
}
>
<KeycloakTextInput
type="text"
id="termsOfServiceUrl"
name={convertAttributeNameToForm("attributes.tosUri")}
data-testid="termsOfServiceUrl"
ref={register}
/>
</FormGroup>
</>
);
};

View file

@ -15,7 +15,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
import { convertAttributeNameToForm, sortProviders } from "../../util";
import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { ApplicationUrls } from "./ApplicationUrls";
type FineGrainOpenIdConnectProps = {
save: () => void;
@ -57,7 +57,7 @@ export const FineGrainOpenIdConnect = ({
setAuthorizationEncryptedResponseOpen,
] = useState(false);
const { control, register } = useFormContext();
const { control } = useFormContext();
const keyOptions = [
<SelectOption key="empty" value="">
@ -148,60 +148,7 @@ export const FineGrainOpenIdConnect = ({
fineGrainedAccess={hasConfigureAccess}
isHorizontal
>
<FormGroup
label={t("logoUrl")}
fieldId="logoUrl"
labelIcon={
<HelpItem
helpText="clients-help:logoUrl"
fieldLabelId="clients:logoUrl"
/>
}
>
<KeycloakTextInput
type="text"
id="logoUrl"
name={convertAttributeNameToForm("attributes.logoUri")}
data-testid="logoUrl"
ref={register}
/>
</FormGroup>
<FormGroup
label={t("policyUrl")}
fieldId="policyUrl"
labelIcon={
<HelpItem
helpText="clients-help:policyUrl"
fieldLabelId="clients:policyUrl"
/>
}
>
<KeycloakTextInput
type="text"
id="policyUrl"
name={convertAttributeNameToForm("attributes.policyUri")}
data-testid="policyUrl"
ref={register}
/>
</FormGroup>
<FormGroup
label={t("termsOfServiceUrl")}
fieldId="termsOfServiceUrl"
labelIcon={
<HelpItem
helpText="clients-help:termsOfServiceUrl"
fieldLabelId="clients:termsOfServiceUrl"
/>
}
>
<KeycloakTextInput
type="text"
id="termsOfServiceUrl"
name={convertAttributeNameToForm("attributes.tosUri")}
data-testid="termsOfServiceUrl"
ref={register}
/>
</FormGroup>
<ApplicationUrls />
<FormGroup
label={t("accessTokenSignatureAlgorithm")}
fieldId="accessTokenSignatureAlgorithm"

View file

@ -5,6 +5,7 @@ import { ActionGroup, Button, FormGroup } from "@patternfly/react-core";
import { FormAccess } from "../../components/form-access/FormAccess";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { ApplicationUrls } from "./ApplicationUrls";
type FineGrainSamlEndpointConfigProps = {
control: Control<Record<string, any>>;
@ -20,6 +21,7 @@ export const FineGrainSamlEndpointConfig = ({
const { t } = useTranslation("clients");
return (
<FormAccess role="manage-realm" isHorizontal>
<ApplicationUrls />
<FormGroup
label={t("assertionConsumerServicePostBindingURL")}
fieldId="assertionConsumerServicePostBindingURL"