From 3f4c0720e1e3421431e7baa20882a4a4512a7fab Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 19 Oct 2025 23:41:23 +0200 Subject: Initial --- src/Utilities/ClaimExtensions.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/Utilities/ClaimExtensions.cs (limited to 'src/Utilities/ClaimExtensions.cs') diff --git a/src/Utilities/ClaimExtensions.cs b/src/Utilities/ClaimExtensions.cs new file mode 100644 index 0000000..f8becc2 --- /dev/null +++ b/src/Utilities/ClaimExtensions.cs @@ -0,0 +1,16 @@ +using System.Linq; +using System.Security.Claims; +using System.Security.Principal; + +namespace IOL.Fagprove.Utilities +{ + public static class ClaimExtensions + { + public static string GetClaimValue(this IPrincipal currentPrincipal, string key) + { + var identity = currentPrincipal.Identity as ClaimsIdentity; + var claim = identity?.Claims.FirstOrDefault(c => c.Type == key); + return claim?.Value; + } + } +} \ No newline at end of file -- cgit v1.3