File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/CodeOfChaos.Extensions Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,27 @@ namespace CodeOfChaos.Extensions;
99// Code
1010// ---------------------------------------------------------------------------------------------------------------------
1111public static class ClaimsIdentityExtensions {
12+
13+ public static ClaimsIdentity AddClaim ( this ClaimsIdentity identity , Claim claim ) {
14+ identity . AddClaim ( claim ) ;
15+ return identity ;
16+ }
17+
18+ public static ClaimsIdentity AddClaims ( this ClaimsIdentity identity , IEnumerable < Claim > claims ) {
19+ identity . AddClaims ( claims ) ;
20+ return identity ;
21+ }
22+
23+ public static ClaimsIdentity RemoveClaim ( this ClaimsIdentity identity , Claim ? claim ) {
24+ identity . RemoveClaim ( claim ) ;
25+ return identity ;
26+ }
27+
28+ public static IEnumerable < string > FindAllValues ( this ClaimsIdentity identity , string type ) {
29+ IEnumerable < Claim > claims = identity . FindAll ( type ) ;
30+ return claims . Select ( c => c . Value ) ;
31+ }
32+
1233 public static ClaimsIdentity AddClaim ( this ClaimsIdentity identity , string type , string value ) {
1334 identity . AddClaim ( new Claim ( type , value ) ) ;
1435 return identity ;
You can’t perform that action at this time.
0 commit comments