1

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?

1 Answer 1

1

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">
        <site>shell</site>
        <site>admin</site>
        <site>website</site>
        <site>xyz</site>
    </sites>
    <identityProviders hint="list:AddIdentityProvider">mapEntry
        <identityProvider ref="federatedAuthentication/identityProviders/identityProvider[@id='AzureAd']" />
        <identityProvider ref="federatedAuthentication/identityProviders/identityProvider[@id='IdentityServer']" />
    </identityProviders>
    <externalUserBuilder type="Sitecore.Owin.Authentication.Services.DefaultExternalUserBuilder, Sitecore.Owin.Authentication">
         <param desc="isPersistentUser">true</param>
    </externalUserBuilder>
</mapEntry>

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

8
  • Which config file is being modified here?
    – Mark Cassidy
    Commented Aug 5, 2019 at 10:16
  • most probably a patch file to override Sitecore.Owin.Authentication.config under app_config/Sitecore/Owin.Authentication Commented Aug 5, 2019 at 10:23
  • "most probably"? You don't know?
    – Mark Cassidy
    Commented Aug 5, 2019 at 10:28
  • its depends on the developer, I prefer to create a patch and few directly updates the config :) Commented Aug 5, 2019 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
    Commented Aug 5, 2019 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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