Skip to content

Commit 6cdd2d0

Browse files
committed
Feat: ClaimsPrincipalExtensions
1 parent e67a262 commit 6cdd2d0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// ---------------------------------------------------------------------------------------------------------------------
2+
// Imports
3+
// ---------------------------------------------------------------------------------------------------------------------
4+
using System.Security.Claims;
5+
6+
namespace CodeOfChaos.Extensions;
7+
8+
// ---------------------------------------------------------------------------------------------------------------------
9+
// Code
10+
// ---------------------------------------------------------------------------------------------------------------------
11+
public static class ClaimsPrincipalExtensions {
12+
public static IEnumerable<string> FindAllValues(this ClaimsPrincipal principal, string type) {
13+
IEnumerable<Claim> claims = principal.FindAll(type);
14+
return claims.Select(c => c.Value);
15+
}
16+
}

0 commit comments

Comments
 (0)