Hi Graham
Your code seems fine at first glance.
One thing to call out is that you should use "policy-scheme" for your default schemes as it is this custom policy scheme which then controls which authentication scheme to use
{
options.DefaultScheme = "policy-scheme";
options.DefaultChallengeScheme = "policy-scheme";
})
Hi Ron,
Many thanks for your reply, I have updated the default scheme as shown above but the issue still persists. The functionality to login via the FE via Identity Server works fine until you add the:
services.AddCmsAspNetIdentity<ApplicationUser>();
line and then it stops working, you can login via Identity Server fine but the user session/cookie is not retained. You can however login to the CMS no problem with it's own session/cookie being retained with no problem.
Thanks,
Graham
Did you find a solution?
I'm facing the same problem. Coming to the login page and loging in but then stay on the login page instead of redirecting to the actual page.
hi, I did find a solution in the end, and I wrote a blog post about it which can be viewed here https://world.optimizely.com/blogs/allthingsopti/dates/2023/2/a-day-in-the-life-of-an-optimizely-developer---implementing-identity-server-4-and-asp-net-identity/ hope that helps?
I've read your post, very nice!
Unfortunatly it doesn't work for me although I don't have exactly the same setup.
I need to have azuread and aspnet identity. I followed your guide, my problem is that loging in with azuread into /episerver admin and edit is working well. Then I want some pages to have read access rights for a specific user in the db. So I set the access right in the tree in the admin.
Then when I try to access this page I get redirected to the login so far so good.
I then log in with the user credential, it worked BUT the redirect is not to the page but back to the login page?
The code I have in my startup class as a middleware extension is below:
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
Does anyone have any experience of successfully implementing mixed-mode authentication in CMS12, or anyone who can provide any pointers/help.
Thanks in advance.