I am trying to implement federated authentication using google in my Sitecore 9 application (CMS not website). I am bale to login to Sitecore using GoogleOAuth2Authentication
and i am using persistent user, so that user is automatically created when they logged on to Sitecore using Gmail.
The problem i am facing is that, in Sitecore, for that particular user, there is no email or full name set to identify and provide access. The mapping I am using is as below:
<propertyInitializer type="Sitecore.Owin.Authentication.Services.PropertyInitializer, Sitecore.Owin.Authentication">
<!--List of property mappings
Note that all mappings from the list will be applied to each providers-->
<maps hint="list">
<!--The mapping sets the Email property of the user profile from emailaddress claim-->
<map name="email claim" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication">
<data hint="raw:AddData">
<!--claim name-->
<source name="Email" />
<!--property name-->
<target name="Email" />
</data>
</map>
<map name="name claim" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication">
<data hint="raw:AddData">
<!--claim name-->
<source name="Name" />
<!--property name-->
<target name="Full name" />
</data>
</map>
</maps>
</propertyInitializer>
I need help in defining the condition, so that name and email field can directly be filled.
Also, In case, if I allow the user to be created automatically in Sitecore, it will result in creating user for all those who logged on to system through gmail. Is there a way, through which I create a user in Sitecore manually and allow only those user with matching email id from gmail authentication?