ClaimsCookie 1.1.0
dotnet add package ClaimsCookie --version 1.1.0
NuGet\Install-Package ClaimsCookie -Version 1.1.0
<PackageReference Include="ClaimsCookie" Version="1.1.0" />
paket add ClaimsCookie --version 1.1.0
#r "nuget: ClaimsCookie, 1.1.0"
// Install ClaimsCookie as a Cake Addin
#addin nuget:?package=ClaimsCookie&version=1.1.0
// Install ClaimsCookie as a Cake Tool
#tool nuget:?package=ClaimsCookie&version=1.1.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 |
---|---|
.NET Framework | net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481 |
-
.NETFramework 4.0
- Microsoft.IdentityModel (>= 6.1.7600.16394)
- WebActivatorEx (>= 2.0.1)
-
.NETFramework 4.5
- WebActivatorEx (>= 2.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.