Identity Providers(mappers): fix help text (#1212)
* fix help text for mapper types * fix name field * address PR feedback from mark and add help text for all mapper types * fix attribute importer help text
This commit is contained in:
parent
80ed33e832
commit
642503e26a
3 changed files with 48 additions and 20 deletions
|
@ -26,7 +26,6 @@ import {
|
||||||
} from "../../components/attribute-form/AttributeForm";
|
} from "../../components/attribute-form/AttributeForm";
|
||||||
import { FormAccess } from "../../components/form-access/FormAccess";
|
import { FormAccess } from "../../components/form-access/FormAccess";
|
||||||
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
|
||||||
import type IdentityProviderMapperRepresentation from "@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation";
|
|
||||||
import type { IdentityProviderAddMapperParams } from "../routes/AddMapper";
|
import type { IdentityProviderAddMapperParams } from "../routes/AddMapper";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { AssociatedRolesModal } from "../../realm-roles/AssociatedRolesModal";
|
import { AssociatedRolesModal } from "../../realm-roles/AssociatedRolesModal";
|
||||||
|
@ -35,6 +34,7 @@ import { useAlerts } from "../../components/alert/Alerts";
|
||||||
import type { IdentityProviderEditMapperParams } from "../routes/EditMapper";
|
import type { IdentityProviderEditMapperParams } from "../routes/EditMapper";
|
||||||
import { convertToFormValues } from "../../util";
|
import { convertToFormValues } from "../../util";
|
||||||
import { toIdentityProvider } from "../routes/IdentityProvider";
|
import { toIdentityProvider } from "../routes/IdentityProvider";
|
||||||
|
import type IdentityProviderMapperRepresentation from "@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation";
|
||||||
|
|
||||||
type IdPMapperRepresentationWithAttributes =
|
type IdPMapperRepresentationWithAttributes =
|
||||||
IdentityProviderMapperRepresentation & {
|
IdentityProviderMapperRepresentation & {
|
||||||
|
@ -58,6 +58,7 @@ export const AddMapper = () => {
|
||||||
|
|
||||||
const [mapperTypes, setMapperTypes] =
|
const [mapperTypes, setMapperTypes] =
|
||||||
useState<Record<string, IdentityProviderMapperRepresentation>>();
|
useState<Record<string, IdentityProviderMapperRepresentation>>();
|
||||||
|
const [mapperType, setMapperType] = useState("advancedAttributeToRole");
|
||||||
const [currentMapper, setCurrentMapper] =
|
const [currentMapper, setCurrentMapper] =
|
||||||
useState<IdentityProviderMapperRepresentation>();
|
useState<IdentityProviderMapperRepresentation>();
|
||||||
const [roles, setRoles] = useState<RoleRepresentation[]>([]);
|
const [roles, setRoles] = useState<RoleRepresentation[]>([]);
|
||||||
|
@ -174,7 +175,15 @@ export const AddMapper = () => {
|
||||||
<PageSection variant="light">
|
<PageSection variant="light">
|
||||||
<ViewHeader
|
<ViewHeader
|
||||||
className="kc-add-mapper-title"
|
className="kc-add-mapper-title"
|
||||||
titleKey={id ? t("editIdPMapper") : t("addIdPMapper")}
|
titleKey={
|
||||||
|
id
|
||||||
|
? t("editIdPMapper", {
|
||||||
|
providerId: providerId.toUpperCase(),
|
||||||
|
})
|
||||||
|
: t("addIdPMapper", {
|
||||||
|
providerId: providerId.toUpperCase(),
|
||||||
|
})
|
||||||
|
}
|
||||||
divider
|
divider
|
||||||
/>
|
/>
|
||||||
<AssociatedRolesModal
|
<AssociatedRolesModal
|
||||||
|
@ -220,7 +229,7 @@ export const AddMapper = () => {
|
||||||
labelIcon={
|
labelIcon={
|
||||||
<HelpItem
|
<HelpItem
|
||||||
id="name-help-icon"
|
id="name-help-icon"
|
||||||
helpText="identity-providers-help:name"
|
helpText="identity-providers-help:addIdpMapperName"
|
||||||
forLabel={t("common:name")}
|
forLabel={t("common:name")}
|
||||||
forID={t(`common:helpLabel`, { label: t("common:name") })}
|
forID={t(`common:helpLabel`, { label: t("common:name") })}
|
||||||
/>
|
/>
|
||||||
|
@ -294,7 +303,12 @@ export const AddMapper = () => {
|
||||||
label={t("mapperType")}
|
label={t("mapperType")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
<HelpItem
|
<HelpItem
|
||||||
helpText="identity-providers-help:mapperType"
|
helpText={
|
||||||
|
mapperType === "attributeImporter" &&
|
||||||
|
(providerId === "oidc" || providerId === "keycloak-oidc")
|
||||||
|
? `identity-providers-help:oidcAttributeImporter`
|
||||||
|
: `identity-providers-help:${mapperType}`
|
||||||
|
}
|
||||||
forLabel={t("mapperType")}
|
forLabel={t("mapperType")}
|
||||||
forID={t(`common:helpLabel`, { label: t("mapperType") })}
|
forID={t(`common:helpLabel`, { label: t("mapperType") })}
|
||||||
/>
|
/>
|
||||||
|
@ -326,6 +340,7 @@ export const AddMapper = () => {
|
||||||
value.toString().toLowerCase()
|
value.toString().toLowerCase()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setMapperType(_.camelCase(value.toString()));
|
||||||
onChange(theMapper?.id);
|
onChange(theMapper?.id);
|
||||||
setMapperTypeOpen(false);
|
setMapperTypeOpen(false);
|
||||||
}}
|
}}
|
||||||
|
@ -368,20 +383,11 @@ export const AddMapper = () => {
|
||||||
}
|
}
|
||||||
fieldId="kc-gui-order"
|
fieldId="kc-gui-order"
|
||||||
>
|
>
|
||||||
<Controller
|
|
||||||
name="config.attributes"
|
|
||||||
defaultValue={"[]"}
|
|
||||||
control={control}
|
|
||||||
render={() => {
|
|
||||||
return (
|
|
||||||
<AttributesForm
|
<AttributesForm
|
||||||
form={form}
|
form={form}
|
||||||
inConfig
|
inConfig
|
||||||
array={{ fields, append, remove }}
|
array={{ fields, append, remove }}
|
||||||
/>
|
/>
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("regexAttributeValues")}
|
label={t("regexAttributeValues")}
|
||||||
|
|
|
@ -107,8 +107,27 @@ export default {
|
||||||
addIdpMapperName: "Name of the mapper.",
|
addIdpMapperName: "Name of the mapper.",
|
||||||
syncModeOverride:
|
syncModeOverride:
|
||||||
"Overrides the default sync mode of the IDP for this mapper. Values are: 'legacy' to keep the behaviour before this option was introduced, 'import' to only import the user once during first login of the user with this identity provider, 'force' to always update the user during every login with this identity provider and 'inherit' to use the sync mode defined in the identity provider for this mapper.",
|
"Overrides the default sync mode of the IDP for this mapper. Values are: 'legacy' to keep the behaviour before this option was introduced, 'import' to only import the user once during first login of the user with this identity provider, 'force' to always update the user during every login with this identity provider and 'inherit' to use the sync mode defined in the identity provider for this mapper.",
|
||||||
mapperType:
|
advancedAttributeToRole:
|
||||||
"If the set of attributes exists and can be matched, grant the user the specified realm or client role.",
|
"If the set of attributes exists and can be matched, grant the user the specified realm or client role.",
|
||||||
|
usernameTemplateImporter: "Format the username to import.",
|
||||||
|
hardcodedUserSessionAttribute:
|
||||||
|
"When a user is imported from a provider, hardcode a value to a specific user session attribute.",
|
||||||
|
externalRoleToRole:
|
||||||
|
"Looks for an external role in a keycloak access token. If external role exists, grant the user the specified realm or client role.",
|
||||||
|
advancedClaimToRole:
|
||||||
|
"If all claims exist, grant the user the specified realm or client role.",
|
||||||
|
claimToRole:
|
||||||
|
"If a claim exists, grant the user the specified realm or client role.",
|
||||||
|
oidcAttributeImporter:
|
||||||
|
"Import declared claim if it exists in ID, access token, or the claim set returned by the user profile endpoint into the specified user property or attribute.",
|
||||||
|
attributeImporter:
|
||||||
|
"Import declared SAML attribute if it exists in assertion into the specified user property or attribute.",
|
||||||
|
hardcodedRole:
|
||||||
|
"When user is imported from provider, hardcode a role mapping for it.",
|
||||||
|
hardcodedAttribute:
|
||||||
|
"When user is imported from provider, hardcode a value to a specific user attribute.",
|
||||||
|
samlAttributeToRole:
|
||||||
|
"If an attribute exists, grant the user the specified realm or client role.",
|
||||||
attributes:
|
attributes:
|
||||||
"Name and (regex) value of the attributes to search for in token. The configured name of an attribute is searched in SAML attribute name and attribute friendly name fields. Every given attribute description must be met to set the role. If the attribute is an array, then the value must be contained in the array. If an attribute can be found several times, then one match is sufficient.",
|
"Name and (regex) value of the attributes to search for in token. The configured name of an attribute is searched in SAML attribute name and attribute friendly name fields. Every given attribute description must be met to set the role. If the attribute is an array, then the value must be contained in the array. If an attribute can be found several times, then one match is sufficient.",
|
||||||
regexAttributeValues:
|
regexAttributeValues:
|
||||||
|
|
|
@ -6,8 +6,8 @@ export default {
|
||||||
providerDetails: "Provider details",
|
providerDetails: "Provider details",
|
||||||
addProvider: "Add provider",
|
addProvider: "Add provider",
|
||||||
addMapper: "Add mapper",
|
addMapper: "Add mapper",
|
||||||
addIdPMapper: "Add Identity Provider Mapper",
|
addIdPMapper: "Add {{providerId}} Identity Provider Mapper",
|
||||||
editIdPMapper: "Edit Identity Provider Mapper",
|
editIdPMapper: "Edit {{providerId}} Identity Provider Mapper",
|
||||||
mappersList: "Mappers list",
|
mappersList: "Mappers list",
|
||||||
noMappers: "No Mappers",
|
noMappers: "No Mappers",
|
||||||
noMappersInstructions:
|
noMappersInstructions:
|
||||||
|
@ -148,6 +148,9 @@ export default {
|
||||||
},
|
},
|
||||||
mapperTypes: {
|
mapperTypes: {
|
||||||
advancedAttributeToRole: "Advanced Attribute To Role",
|
advancedAttributeToRole: "Advanced Attribute To Role",
|
||||||
|
advancedClaimToRole: "Advanced Claim To Role",
|
||||||
|
externalRoleToRole: "External Role To Role",
|
||||||
|
claimToRole: "Claim To Role",
|
||||||
usernameTemplateImporter: "Username Template Importer",
|
usernameTemplateImporter: "Username Template Importer",
|
||||||
hardcodedUserSessionAttribute: "Hardcoded User Session Attribute",
|
hardcodedUserSessionAttribute: "Hardcoded User Session Attribute",
|
||||||
attributeImporter: "Attribute Importer",
|
attributeImporter: "Attribute Importer",
|
||||||
|
|
Loading…
Reference in a new issue