-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared Cookie between ASP.NET and ASP.NET Core not reading custom claims #535
Comments
You're adding the new claim to a second identity, but you're only searching the first identity for claims later. Try searching ClaimsPrincipal.Claims to see claims from all identities. |
Unfortunately it's not in there either.
I also only see one identity. |
It seems that when I add the claim directly to the current identity, instead of adding a new identity to the principal, it does work. I'm not sure why in all the microsoft docs I was finding to add a second identity then. I even found articles stating that adding directly to the current identity doesn't even work.
I also found documentation from Microsoft saying I should be adding custom claims through the IClaimsTransformation.
I did try that, but that doesn't work in either cases. The custom claim is not persisted. It's not even persisted through different calls to the I feel like I'm mising something, or doing something wrong here. But I can't put my finger on it. |
Ah, the old interop serializer only supports one identity, so that explains that part. |
Great! So it's safe to use it like I'm using it now then? |
Hi
We have set up cookie sharing between my ASP.NET and ASP.NET Core application. I did this using the guidance found here:
This all works great, but we have now noticed that custom claims we are adding in our ASP.NET Core application are not being read/remembered in the ASP.NET application.
We are adding the custom claim in ASP.NET Core as follows:
And in ASP.NET we are reading the claims as follows:
However, the 'NEWCLAIM' is missing. All the other default claims we get from the identity provider are there.
Any ideas, something we might be missing?
Thanks!
The text was updated successfully, but these errors were encountered: