I am using Sitecore 9.1, I have multi-sites using different hostnames.

can I share user context between sites after successful authentication from one site, instead of authenticating from each site separately?


Depending upon the provider you use, you can easily enter values for the sites (the list of sites where the provider(s) will work), identityProviders (the list of providers), and externalUserBuilder child nodes. This config will be your custom file if you are using some other provider and if you are using this for Owin OOTB, you can override Sitecore.Owin.Authentication.config under app_config/Sitecore/Owin.Authentication

In the mapEntry within the identityProvidersPerSites, you can define multiple sites for which you want to enable the authentication -

<mapEntry name ="all" type="Sitecore.FederatedAuthentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.FederatedAuthentication">
    <sites hint="list">
    <identityProviders hint="list:AddIdentityProvider">mapEntry
        <identityProvider ref="federatedAuthentication/identityProviders/identityProvider[@id='AzureAd']" />
        <identityProvider ref="federatedAuthentication/identityProviders/identityProvider[@id='IdentityServer']" />
    <externalUserBuilder type="Sitecore.Owin.Authentication.Services.DefaultExternalUserBuilder, Sitecore.Owin.Authentication">
         <param desc="isPersistentUser">true</param>

With this configuration, a virtual user would be created in the Sitecore instance for the authenticated user but this user might not have permission to access Sitecore client application. you need to provide proper rights to access Sitecore client. For more read the configure an identity provider section here - https://doc.sitecore.com/developers/90/sitecore-experience-management/en/configure-federated-authentication.html

| improve this answer | |
  • Which config file is being modified here? – Mark Cassidy Aug 5 '19 at 10:16
  • most probably a patch file to override Sitecore.Owin.Authentication.config under app_config/Sitecore/Owin.Authentication – Mahendra Shekhawat Aug 5 '19 at 10:23
  • "most probably"? You don't know? – Mark Cassidy Aug 5 '19 at 10:28
  • its depends on the developer, I prefer to create a patch and few directly updates the config :) – Mahendra Shekhawat Aug 5 '19 at 10:30
  • You're missing my point. There is no reference in your answer as to what files are being patched. Nor is your config complete enough (full path structure) to be useful on it's own. – Mark Cassidy Aug 5 '19 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.