Reputation: 87
I use a .NET Framework 4.8 app as a central auth provider to set a cookie protected by machine key (AES, SHA1).
I want to validate the cookie on my blazor server app which runs on .net 8.0.
I have tried using aspnetTicketBridge. The following code produces ticket as null (without exceptions). The cookieValue is indeed correct. Any suggestions would be helpful.
string cookieValue = _httpContextAccessor.HttpContext.Request.Cookies["MyCookieName"];
string[] test = { "Microsoft.Owin.Security.OAuth", "ApplicationCookie", "v1" };
var ticketDataFormat = new AspNet4TicketDataFormat(
new MachineKeyDataProtector("same from machine key config of .net framework"
, "same from machine key config of .net framework"
, "AES"
, "SHA1")
.ForPurposes(test)
);
var ticket = ticketDataFormat.Unprotect(cookieValue);
Upvotes: 0
Views: 100