Serialize User Info in a Protected Cookie NuGet Package

An HttpModule that will serialize user information to a chunked protected cookie (with MachineKey) and deserialize on every request to a ClaimsPrincipal.

Usage:

var user = new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>("name", "John Foo"),
new KeyValuePair<string, object>("id", "1234"),
new KeyValuePair<string, object>("email", "[email protected]")
};

ClaimsCookieModule.Instance.CreateSessionSecurityToken(user);

That's it.

Now, you will be able to access the user claims like this:

((IClaimsIdentity)User.Identity).Claims

The cookie will be chunked in multiple cookies to avoid hitting a limit if you are storing lots of user info and it will be deflated and protected with the machine key.




Got any Serialize User Info in a Protected Cookie Question?





Info

Version: 1.1.0
Author(s): Auth0
Last Update: Tuesday, July 23, 2013
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/auth0/ClaimsCookie
NuGet Url: https://www.nuget.org/packages/ClaimsCookie


Install
Install-Package ClaimsCookie
dotnet add package ClaimsCookie
paket add ClaimsCookie
ClaimsCookie Download (Unzip the "nupkg" after downloading)

.NETFramework 4.0 .NETFramework 4.5 1 package depend on this package.


Tags



STATS

must-have-score

.8

avg-downloads-per-day

3

days-since-last-release

4139