Skip to content
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

.NET Framework SameSite update and OWIN problem with Ws-Federation #324

Closed
JaapMosselman opened this issue Dec 18, 2019 · 5 comments
Closed

Comments

@JaapMosselman
Copy link

JaapMosselman commented Dec 18, 2019

I have .NET Framework 4.7 ASP.NET MVC application using Owin with Owin Ws-Federation for AAD authentication. After the .NET Framework update was installed on the server last week, we could not authenticate with AAD in some cases. I updated to Owin 4.1 but that did not fix the problem.
When I used Chrome (79) it dit not work, but when I use Edge it just works.
So I analyzed by debugging the application (got Owin code locally to debug it). What I saw was that the /signing-federation POST callback is just there with the correct information. The Owin Ws-Federation middleware sets the .AspNet.External cookie with the identity. But for some reason that cookie seems to be left out from the actual written response. With Chrome it is not in the response. With Edge it is. I looked even with Fiddler to the response to verify that. I can't see why it would be UA dependent. So it seems randomly. In my opinion this has nothing to do with the SameSite changes which just should do something with a value inside the cookie.
Any idea what's going on here?

@Tratcher
Copy link
Member

You're right that this doesn't sound SameSite specific, though it's odd that it's browser specific.

The usual issue with vanishing cookies is addressed by adding the SystemWebCookieManager:
https://github.com/aspnet/AspNetKatana/wiki/System.Web-response-cookie-integration-issues

@JaapMosselman
Copy link
Author

@Tratcher Thanks for your response. Using the SystemWebCookieManager seems to fix the problem.
But still strange that the .NET Framework update seems to trigger this issue now.
I even removed the update from the server, which fixed the problem and after reinstalling again, the problem was there also again.
BTW: is it just save to start using the SystemWebCookieManager? No performance implications or other known issues?

@Tratcher
Copy link
Member

Yes, SystemWebCookieManager (or SystemWebChunkingCookieManager) use is recommended when running on IIS.

@JaapMosselman
Copy link
Author

Ok, if I am right the ChunkingCookieManager is what is default used by Owin, isn't it?
So I can best use SystemWebChunkingCookieManager, I think.

@Tratcher
Copy link
Member

Yes, ChunkingCookieManager is the default for CookieAuthenticationOptions.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants