14 lines
322 B
C#
14 lines
322 B
C#
|
namespace Newsbot.Collector.Api.Authentication;
|
||
|
|
||
|
public static class JwtUserIdExtension
|
||
|
{
|
||
|
public static string GetUserId(this HttpContext context)
|
||
|
{
|
||
|
if (context.User == null)
|
||
|
{
|
||
|
return string.Empty;
|
||
|
}
|
||
|
|
||
|
return context.User.Claims.Single(x => x.Type == "id").Value;
|
||
|
}
|
||
|
}
|