blob: 4f8f47f4ca67df8c46895efe856413b1b03e0f89 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using System;
using System.Linq;
using System.Security.Claims;
using IOL.Helpers;
using Microsoft.AspNetCore.Mvc;
namespace VSH.Controllers;
[ApiController]
[Route("api/[controller]")]
public class MainControllerBase : ControllerBase
{
public string CurrentHost => Request.GetRequestHost();
protected LoggedInUserModel LoggedInUser => new() {
Username = User.Identity?.Name,
Id = User.Claims.SingleOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value.ToGuid() ?? default
};
protected class LoggedInUserModel
{
public Guid Id { get; set; }
public string Username { get; set; }
}
}
|