mirror of
https://github.com/fergalmoran/podnoms.git
synced 2026-02-10 17:55:12 +00:00
16 lines
415 B
C#
Executable File
16 lines
415 B
C#
Executable File
using System;
|
|
using System.Security.Claims;
|
|
|
|
namespace PodNoms.Api.Services.Auth
|
|
{
|
|
public static class ClaimsPrincipalExtensions
|
|
{
|
|
public static string GetUserId(this ClaimsPrincipal principal)
|
|
{
|
|
if (principal == null)
|
|
throw new ArgumentNullException(nameof(principal));
|
|
|
|
return principal.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
|
}
|
|
}
|
|
} |