idunno.CookieSharing icon indicating copy to clipboard operation
idunno.CookieSharing copied to clipboard

Cookie sharing fails if cookie has several chunks.

Open amojicamu opened this issue 8 years ago • 5 comments

Hi. I'm seeing an issue where ticket sharing won't work if the cookie content is long and has several chunks.

Steps to reproduce:

Get latest for idunno.CookieSharing. In idunno.CookieSharing.Core, HomeController.cs, add a (very) long claim to the ClaimsIdentity so the cookie is chunked.

Run both .Net Core and .Net 4.5 websites.

.Net 4.5 site sees the cookie, but the user is not logged in.

At the bottom of the page there is still the "Create a login cookie" option.

Any ideas on how to fix this?

amojicamu avatar Dec 12 '16 12:12 amojicamu

Update: I got it working by coping the code from https://github.com/jchannon/katanaproject/blob/master/src/Microsoft.Owin/Infrastructure/ChunkingCookieManager.cs and then replacing "chunks:" with "chunks-" and assigning this custom CookieManager at UseCookieAuthentication in the .Net 4.5 project.

I think this should be backwards compatible out of the box. I there something I'm missing?

amojicamu avatar Dec 12 '16 12:12 amojicamu

Hmm strange. @Tratcher @HaoK did the chunking format change in cookies?

blowdart avatar Dec 15 '16 12:12 blowdart

Yes, katana was using a character in the first line that wasn't supposed to be used in cookies. : I think.

Tratcher avatar Dec 15 '16 15:12 Tratcher

There's a new CookieChunkingManager in the interop package you can plug into Katana handle this. https://github.com/aspnet/Security/blob/dev/src/Microsoft.Owin.Security.Interop/ChunkingCookieManager.cs

Tratcher avatar Dec 15 '16 19:12 Tratcher

Thanks @Tratcher. I'll give it a try

amojicamu avatar Dec 17 '16 16:12 amojicamu