18 lines
540 B
C#
18 lines
540 B
C#
|
|
using System.Security.Claims;
|
||
|
|
using FrontOffice.BFF.Application.Common.Interfaces;
|
||
|
|
using Microsoft.AspNetCore.Http;
|
||
|
|
|
||
|
|
namespace FrontOffice.BFF.WebApi.Common.Services;
|
||
|
|
|
||
|
|
public class CurrentUserService : ICurrentUserService
|
||
|
|
{
|
||
|
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||
|
|
|
||
|
|
public CurrentUserService(IHttpContextAccessor httpContextAccessor)
|
||
|
|
{
|
||
|
|
_httpContextAccessor = httpContextAccessor;
|
||
|
|
}
|
||
|
|
|
||
|
|
public string? UserId => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier);
|
||
|
|
}
|