2

I'm using Sitecore 9.1, thus an identity provider.

I have a custom domain named aba and I'm logged in Sitecore Administration Console using an aba\hsantos user.

Then I have this processor which is running on a custom site definition called coveoapi.

<site name="coveoapi" virtualFolder="/coveo" physicalFolder="/coveo" enableTracking="false" content="master" domain="sitecore" loginPage="/identity/login/shell/SitecoreIdentityServer"/>

During its execution, the Sitecore.Context.Domain is always sitecore no matter who is logged in.

Not only that, but the current user is always sitecore\Anonymous.

enter image description here

I suspect that my identity provider is not resolving correctly users from aba domain when the current site is coveoapi.

Anyone knows how to fix this?

4
  • 4
    Sitecore.Context.Domain is your site context domain, as specified in the very config you post a snippet of. Sitecore.Context.User.Domain should be what you're looking for. Also, be aware of which sites you authenticate to - which may or not be the same as the one you list here. May 9, 2019 at 15:12
  • Right there in your config you have the domain for that site set to sitecore: domain="sitecore". If you are logging into a different site in the site definitions, you will be anonymous in the coveoapi site.
    – Richard Seal
    May 9, 2019 at 15:47
  • @MarkCassidy thanks Mark. One thing that's weird is that I never authenticate to coveoapi and still when I access the instance using the instance name instead of a hostName (aka the site is resolved to website) the same test gives my the logged user aba\hsantos. That only leads me to think that I must authenticate on the resolved site for the current page, not really the site for the processor. Does that make sense? May 9, 2019 at 17:28
  • Btw all I said is true even if the logged user is sitecore\admin, so we can remove the domain from the possible causes. I'm tending towards something related to Identity provider can't resolve the current user for a given hostName. May 9, 2019 at 17:41

1 Answer 1

1

Finally just like pointed by Mark in comments, I was only logged in the [instance-name]/ context.

In order to be able to log in other websites, I had to edit the config/production/Sitecore.IdentityServer.Host.xml <AllowedCorsOrigins> config in Identity Server instance and add the other website hostnames.

Now I can go to aba.local/sitecore and log in, and by doing that, my processor has aba\hsantos in Sitecore.Context.User.

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.