Identity
Identity copied to clipboard
ClaimsPrincipal.WriteTo(BinaryWriter) -> new ClaimsPrincipal(BinaryReader) not working
Hello, I'm using dotnetcore 1.1 with full framework 4.6.2. I'm trying to implement an ITicketStore. using ClaimsPrincipal.WriteTo(BinaryWriter) and reading it back with new ClaimsPrincipal(BinaryReader) :
var memoryStream = new MemoryStream();
var binaryWriter = new BinaryWriter(memoryStream);
ticket.Principal.WriteTo(binaryWriter);
memoryStream.Seek(0, SeekOrigin.Begin);
BinaryReader reader = new BinaryReader(memoryStream);
var claimsPrincipal = new ClaimsPrincipal(reader);
throws ArgumentException: an item with the same key has already been added
Thanks in advance, Andrea
PS. I attached File generated by serializing to file instead of to memorystream, same error
Anyway, looking into source code, I solved using TicketSerializer.Default
Still having the same problem on netstandard 2.0