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
.
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?
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.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 thecoveoapi
site.coveoapi
and still when I access the instance using the instance name instead of a hostName (aka the site is resolved towebsite
) the same test gives my the logged useraba\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?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.