fixing labels in case of SAML (#2111)

This commit is contained in:
Erik Jan de Wit 2022-02-21 14:55:02 +01:00 committed by GitHub
parent 9fa1c1303f
commit 0065e9c7c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View file

@ -12,6 +12,7 @@ import { useRealm } from "../../context/realm-context/RealmContext";
import { DescriptorSettings } from "./DescriptorSettings"; import { DescriptorSettings } from "./DescriptorSettings";
import { getBaseUrl } from "../../util"; import { getBaseUrl } from "../../util";
import { DiscoveryEndpointField } from "../component/DiscoveryEndpointField"; import { DiscoveryEndpointField } from "../component/DiscoveryEndpointField";
import environment from "../../environment";
export const SamlConnectSettings = () => { export const SamlConnectSettings = () => {
const { t } = useTranslation("identity-providers"); const { t } = useTranslation("identity-providers");
@ -70,13 +71,18 @@ export const SamlConnectSettings = () => {
fieldLabelId="identity-providers:serviceProviderEntityId" fieldLabelId="identity-providers:serviceProviderEntityId"
/> />
} }
isRequired
helperTextInvalid={t("common:required")}
validated={errors.config?.entityId ? "error" : "default"}
> >
<TextInput <TextInput
type="text" type="text"
name="config.entityId" name="config.entityId"
data-testid="serviceProviderEntityId" data-testid="serviceProviderEntityId"
id="kc-service-provider-entity-id" id="kc-service-provider-entity-id"
ref={register()} ref={register({ required: true })}
validated={errors.config?.entityId ? "error" : "default"}
defaultValue={`${environment.authServerUrl}/realms/${realm}`}
/> />
</FormGroup> </FormGroup>

View file

@ -64,11 +64,15 @@ export const DiscoveryEndpointField = ({
return ( return (
<> <>
<FormGroup <FormGroup
label={t("useDiscoveryEndpoint")} label={t(
fieldId="kc-discovery-endpoint-switch" id === "oidc" ? "useDiscoveryEndpoint" : "useEntityDescriptor"
)}
fieldId="kc-discovery-endpoint"
labelIcon={ labelIcon={
<HelpItem <HelpItem
helpText="identity-providers-help:useDiscoveryEndpoint" helpText={`identity-providers-help:${
id === "oidc" ? "useDiscoveryEndpoint" : "useEntityDescriptor"
}`}
fieldLabelId="identity-providers:discoveryEndpoint" fieldLabelId="identity-providers:discoveryEndpoint"
/> />
} }
@ -83,11 +87,15 @@ export const DiscoveryEndpointField = ({
</FormGroup> </FormGroup>
{discovery && ( {discovery && (
<FormGroup <FormGroup
label={t("discoveryEndpoint")} label={t(
id === "oidc" ? "discoveryEndpoint" : "samlEntityDescriptor"
)}
fieldId="kc-discovery-endpoint" fieldId="kc-discovery-endpoint"
labelIcon={ labelIcon={
<HelpItem <HelpItem
helpText="identity-providers-help:discoveryEndpoint" helpText={`identity-providers-help:${
id === "oidc" ? "discoveryEndpoint" : "samlEntityDescriptor"
}`}
fieldLabelId="identity-providers:discoveryEndpoint" fieldLabelId="identity-providers:discoveryEndpoint"
/> />
} }
@ -113,7 +121,7 @@ export const DiscoveryEndpointField = ({
placeholder={ placeholder={
id === "oidc" id === "oidc"
? "https://hostname/auth/realms/master/.well-known/openid-configuration" ? "https://hostname/auth/realms/master/.well-known/openid-configuration"
: "https://hostname/context/saml/discovery" : ""
} }
onBlur={() => setDiscovering(true)} onBlur={() => setDiscovering(true)}
validated={ validated={