Files
kemkas-gh-mirror/Kemkas.Web/Controllers/UserController.cs
T
morbalint ea5bdd7f1e chore: useBasePath("/api") & better local forwarded headers
refactor from workaround hack to idempotent solution
2024-01-09 23:06:56 +01:00

18 lines
458 B
C#

using Kemkas.Web.Db.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
namespace Kemkas.Web.Controllers;
[Route("[controller]")]
[ApiController]
public class UserController : ControllerBase
{
// GET
[HttpGet("me")]
public async Task<string?> Me([FromServices] UserManager<ApplicationUser> userManager)
{
var user = await userManager.GetUserAsync(User);
return user?.UserName ?? user?.Email;
}
}