We are trying to understand how to customize the Sitecore Identity Server. We are using Sitecore 9.3.
Based on this article, by default, there are 5 claims available from Sitecore:
- name
- role
http://www.sitecore.net/identity/claims/isAdmin
http://www.sitecore.net/identity/claims/originalIssuer
In Sitecore, we have many custom user profile properties such as first name
, middle name
,last name
, gender
, etc.
We would like to know how to include these custom user profile properties as part of the claims in the Identity Server. Is there any configuration that we need to add or modify or do we need to create a custom Identity Server provider?
We already tried this solution to try to add the default Sitecore user profile (for example comment
field) to the Identity Server claim
but it still does not work.
Below are our identityServer.xml
config:
<IdentityResources>
<SitecoreIdentityResource>
<Name>sitecore.profile</Name>
<UserClaims>
<UserClaim1>name</UserClaim1>
<UserClaim2>email</UserClaim2>
<UserClaim3>role</UserClaim3>
<UserClaim4>http://www.sitecore.net/identity/claims/isAdmin</UserClaim4>
<UserClaim5>http://www.sitecore.net/identity/claims/originalIssuer</UserClaim5>
<UserClaim6>comment</UserClaim6>
</UserClaims>
<Required>true</Required>
</SitecoreIdentityResource>
</IdentityResources>
...
<ExternalIdentityProviders>
<IdentityProviders>
<IdentityServer type="Sitecore.Plugin.IdentityProviders.IdentityProvider, Sitecore.Plugin.IdentityProviders">
<AuthenticationScheme>idsvr</AuthenticationScheme>
<DisplayName>Identity Server</DisplayName>
<ClaimsTransformations>
<ClaimsTransformation1 type="Sitecore.Plugin.IdentityProviders.DefaultClaimsTransformation, Sitecore.Plugin.IdentityProviders">
<SourceClaims>
<Claim1 type="Comment" />
</SourceClaims>
<NewClaims>
<Claim1 type="comment" />
</NewClaims>
</ClaimsTransformation1>
</ClaimsTransformations>
</IdentityServer>
</IdentityProviders>
</ExternalIdentityProviders>
and our Sitecore.Owin.Authentication.IdentityServer.config
<propertyInitializer>
<maps>
<map name="set IsAdministrator" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
<data hint="raw:AddData">
<source name="http://www.sitecore.net/identity/claims/isAdmin" value="true" />
<target name="IsAdministrator" value="true" />
</data>
</map>
<map name="set Comment" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
<data hint="raw:AddData">
<source name="comment" />
<target name="Comment" />
</data>
</map>
</maps>
</propertyInitializer>