pet-companion-back/Controllers/BaseController.cs

14 lines
340 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace PetCompanion.Controllers
{
[Authorize]
[ApiController]
[Route("api/v1/[controller]")]
public class BaseController : Controller
{
protected string userId => User.Claims.FirstOrDefault(c => c.Type == "user_id").Value;
}
}