ClaimsCookie 1.2.0
dotnet add package ClaimsCookie --version 1.2.0
NuGet\Install-Package ClaimsCookie -Version 1.2.0
<PackageReference Include="ClaimsCookie" Version="1.2.0" />
paket add ClaimsCookie --version 1.2.0
#r "nuget: ClaimsCookie, 1.2.0"
// Install ClaimsCookie as a Cake Addin #addin nuget:?package=ClaimsCookie&version=1.2.0 // Install ClaimsCookie as a Cake Tool #tool nuget:?package=ClaimsCookie&version=1.2.0
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", "foo@gmail.com")
};
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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.0
- Microsoft.IdentityModel (>= 6.1.7600.16394)
- WebActivatorEx (>= 2.0.1)
-
.NETFramework 4.5
- WebActivatorEx (>= 2.0.1)
GitHub repositories
This package is not used by any popular GitHub repositories.