using System; using System.Collections.Generic; using System.Security.Claims; using Microsoft.Owin.Security.Interop; class Program { static void Main() { var claims = new List { new Claim(ClaimTypes.Name, "irelyadmin"), new Claim(ClaimTypes.NameIdentifier, "1"), new Claim(ClaimTypes.Role, "Administrator"), new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "idsrv3test"), new Claim("Company", "01"), new Claim("UserId", "1"), new Claim("intRoleId", "1"), new Claim("intUserRoleID", "1"), }; var identity = new ClaimsIdentity(claims, "ApplicationCookie", ClaimTypes.Name, ClaimTypes.Role); var authProps = new Microsoft.Owin.Security.AuthenticationProperties { IssuedUtc = DateTimeOffset.UtcNow, ExpiresUtc = DateTimeOffset.UtcNow.AddHours(1), }; authProps.Dictionary[".AspNet.Identity.UserId"] = "1"; authProps.Dictionary[".AspNet.Identity.UserName"] = "irelyadmin"; var ticket = new Microsoft.Owin.Security.AuthenticationTicket(identity, authProps); var serializer = new AspNetTicketSerializer(); byte[] serialized = serializer.Serialize(ticket); // Output as base64 — we'll protect it in Python Console.WriteLine(Convert.ToBase64String(serialized)); } }