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:
Jenny 2021-09-24 16:27:44 -04:00 committed by GitHub
parent 80ed33e832
commit 642503e26a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 20 deletions

View file

@ -26,7 +26,6 @@ import {
} from "../../components/attribute-form/AttributeForm";
import { FormAccess } from "../../components/form-access/FormAccess";
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 _ from "lodash";
import { AssociatedRolesModal } from "../../realm-roles/AssociatedRolesModal";
@ -35,6 +34,7 @@ import { useAlerts } from "../../components/alert/Alerts";
import type { IdentityProviderEditMapperParams } from "../routes/EditMapper";
import { convertToFormValues } from "../../util";
import { toIdentityProvider } from "../routes/IdentityProvider";
import type IdentityProviderMapperRepresentation from "@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation";
type IdPMapperRepresentationWithAttributes =
IdentityProviderMapperRepresentation & {
@ -58,6 +58,7 @@ export const AddMapper = () => {
const [mapperTypes, setMapperTypes] =
useState<Record<string, IdentityProviderMapperRepresentation>>();
const [mapperType, setMapperType] = useState("advancedAttributeToRole");
const [currentMapper, setCurrentMapper] =
useState<IdentityProviderMapperRepresentation>();
const [roles, setRoles] = useState<RoleRepresentation[]>([]);
@ -174,7 +175,15 @@ export const AddMapper = () => {
<PageSection variant="light">
<ViewHeader
className="kc-add-mapper-title"
titleKey={id ? t("editIdPMapper") : t("addIdPMapper")}
titleKey={
id
? t("editIdPMapper", {
providerId: providerId.toUpperCase(),
})
: t("addIdPMapper", {
providerId: providerId.toUpperCase(),
})
}
divider
/>
<AssociatedRolesModal
@ -220,7 +229,7 @@ export const AddMapper = () => {
labelIcon={
<HelpItem
id="name-help-icon"
helpText="identity-providers-help:name"
helpText="identity-providers-help:addIdpMapperName"
forLabel={t("common:name")}
forID={t(`common:helpLabel`, { label: t("common:name") })}
/>
@ -294,7 +303,12 @@ export const AddMapper = () => {
label={t("mapperType")}
labelIcon={
<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")}
forID={t(`common:helpLabel`, { label: t("mapperType") })}
/>
@ -326,6 +340,7 @@ export const AddMapper = () => {
value.toString().toLowerCase()
);
setMapperType(_.camelCase(value.toString()));
onChange(theMapper?.id);
setMapperTypeOpen(false);
}}
@ -368,20 +383,11 @@ export const AddMapper = () => {
}
fieldId="kc-gui-order"
>
<Controller
name="config.attributes"
defaultValue={"[]"}
control={control}
render={() => {
return (
<AttributesForm
form={form}
inConfig
array={{ fields, append, remove }}
/>
);
}}
/>
</FormGroup>
<FormGroup
label={t("regexAttributeValues")}

View file

@ -107,8 +107,27 @@ export default {
addIdpMapperName: "Name of the mapper.",
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.",
mapperType:
advancedAttributeToRole:
"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:
"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:

View file

@ -6,8 +6,8 @@ export default {
providerDetails: "Provider details",
addProvider: "Add provider",
addMapper: "Add mapper",
addIdPMapper: "Add Identity Provider Mapper",
editIdPMapper: "Edit Identity Provider Mapper",
addIdPMapper: "Add {{providerId}} Identity Provider Mapper",
editIdPMapper: "Edit {{providerId}} Identity Provider Mapper",
mappersList: "Mappers list",
noMappers: "No Mappers",
noMappersInstructions:
@ -148,6 +148,9 @@ export default {
},
mapperTypes: {
advancedAttributeToRole: "Advanced Attribute To Role",
advancedClaimToRole: "Advanced Claim To Role",
externalRoleToRole: "External Role To Role",
claimToRole: "Claim To Role",
usernameTemplateImporter: "Username Template Importer",
hardcodedUserSessionAttribute: "Hardcoded User Session Attribute",
attributeImporter: "Attribute Importer",