Security
Installation
dotnet add package Structr.SecurityUsage
Claims
var claimsIdentity = new ClaimsIdentity();
// Add claims fluently without Claim constructors.
claimsIdentity.AddClaim("SomeClaimType", "1,25")
.AddClaim("SomeClaimType", "3,57")
.AddClaim("SomeAnotherClaimType", "value 1")
.AddClaim("SomeAnotherClaimType", "value 2")
.AddClaim("AndAnotherClaimType", "True");
// Replaces value for claim with type "SomeAnotherClaimType".
claimsIdentity.SetClaim("SomeAnotherClaimType", "1,25");
// Getting claim value converted to specified type.
float someClaimValue = claimsIdentity.GetFirstClaim<float>("SomeClaimType"); // Returns 1.25F
// Removes claims with type "SomeClaimType".
claimsIdentity.RemoveAllClaims("SomeClaimType");
// Getting all claims values as a string with type "SomeAnotherClaimType".
IEnumerable<string> someAnotherClaimValues = claimsIdentity.FindAllValues("SomeAnotherClaimType");Hashes
Method name
Return type
Description
Encryption
Method name
Return type
Description
Last updated