❔ Help with Duende Login for part of page
I am having an issue that I have been struggeling with for quite some time now.
I want only part of my client blazor server to need duende Authorization. I have done this with adding @attribute [Authorize] or [AllowAnonymous], and when it needs autorization it goes into my App.Razor, and the cascadingauthenticationstate checks if it is not authroized. If not it goes into my RedirectTologin component I'll show here:
App.Razor:
https://pastebin.com/vTrzFD35
RedirectToLogin.razor
https://pastebin.com/ZHgMxBzh
This works as expected, and it goes into duende login.
The login is logging in successfully . After a successfull login the duende is supposed to redirect to authentication/login-callback, and it does.
It even sets the cookies in my browser, ".AspNetCore.Identity.Application", "idsrv.session" and the ".AspNetCore.Antiforgery.VMx79YeDpl8"
Duende Logs after login:
https://pastebin.com/2yBiWYF5
Then after the login is a success, it redirects back to the /authentication/login-callback page. I'll post the page under:
LoginCallback.razor
https://pastebin.com/UY6VcL9h
The problem is that the user is never authenticated, even if we all agree on the authentication process on the duende side seems to be correct.
The user object when printed out looks something like this:
https://pastebin.com/cLVgmEFN
This is the link Duende sends me back to:
https://localhost:5137/authentication/login-callback?code=8750F9C493F12A2CC5DAEB72CE921995876680B58CE4A2FAC343AAD73453E703-1&scope=openid%20profile%20verification&state=https%3A%2F%2Flocalhost%3A5137%2Fcreate&session_state=sUNjennY1fbZSsGb-BzorJK6ztO-UzdEiK9fnTi3UKs.3834D93E71029967EA54DBBA84CF1AFF&iss=https%3A%2F%2Flocalhost%3A5001
Some other info Blazor Servers Program.cs:
https://pastebin.com/ns9S2bad
Duende's HostExtensions.cs
https://pastebin.com/uRBqs21R
Duende's Config.cs
https://pastebin.com/41vGKEi1
Duende's Login Index.cshtml.cs
https://pastebin.com/6AcdAAGb
I'll be happy to provide some more information
Pastebin
@using Microsoft.AspNetCore.Components.Authorization
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
@using System.Security.Cryptography@using System.Text@using Identit...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
[13:22:40 Debug] Duende.IdentityServer.Endpoints.AuthorizeEndpointV...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
@page "/authentication/login-callback"@using Microsoft.AspNetCore.C...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
{ "Claims": [], "Identities": [ { "Au...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
1 Reply
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.