I have backoffice functionality that should require Sitecore identity server logins with specific permissions/roles. It is hosted on its own Sitecore-site definition and subdomain, for example backoffice.mainsite.com.
I would like to restrict access to the site, requiring users to log in via Sitecore login.
Setup
I have tried the following guide from briancaos which states to:
- Set
requireLogin
= "true" - Set the
loginPage
for the site definition
On the backoffice site definition I have set the loginPage
property to /identity/login/shell/SitecoreIdentityServer
. Furthermore, I have added the subdomain in AllowedCorsOriginsGroup2
in Sitecore.IdentityServer.Host.xml
.
Problem
When I attempt to access the site I am correctly redirected to the Sitecore login page. So far, so good.
At this point, I have verified that the redirect_uri
is pointing to "backoffice.mainsite.com".
From the Sitecore login page I can successfully log in.
Upon successful login I am redirected back to backoffice.mainsite.com
, which immediately redirects me back to the Sitecore login page.
Back at the Sitecore login page, I have verified that I am indeed logged in:
- I can see the username in the upper right corner of the page
- I can successfully navigate to and browse parent.local/sitecore
However, trying to access any page on backoffice.mainsite.com
leads me to the Sitecore login page again.
So it seems that while I can successfully log in using the Sitecore login page, I can't actually log in as I cannot access the site. The Sitecore logs do not show any issues.
The site defition is shown below.
<site name="customerserviceportal" patch:before="site[@name='website']"
inherits="airshoppen-abstract-site-definition"
hostName="csp.airshoppen.local"
targetHostName="csp.airshoppen.local"
language="en"
rootPath="/sitecore/content/Customer Service Portal/"
startItem="/Pages/CartSearchPage"
requireLogin="true"
domain="sitecore" <-- Added
loginPage="/sitecore/login" <-- Thanks to @AlinaFodor
/>
<site name="airshoppen-abstract-site-definition"
virtualFolder="/"
physicalFolder="/"
startItem="/FrontPage"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
disableClientData="false"
formsRoot="{F1F7AAB6-C8CE-422F-A214-F610C109FA63}"
scheme="https"
externalPort="80"
enableItemLanguageFallback="true"
enableFieldLanguageFallback="true"
loginPage ="/"
/>
Can anyone help?