From 8505259714b27c366f6bdf0fbb14914517b628e0 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 3 Mar 2026 09:17:36 +0100 Subject: [PATCH] Add AuthController with /auth/me user info endpoint Introduced AuthController secured with [Authorize] attribute. Provides a GET /auth/me endpoint that returns the authenticated user's identity details and claims. --- Controllers/AuthController.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Controllers/AuthController.cs diff --git a/Controllers/AuthController.cs b/Controllers/AuthController.cs new file mode 100644 index 0000000..eb704c5 --- /dev/null +++ b/Controllers/AuthController.cs @@ -0,0 +1,24 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace FakeNTLMServer.Controllers +{ + [ApiController] + [Route("[controller]")] + [Authorize] + public class AuthController : ControllerBase + { + [HttpGet("me")] + public IActionResult GetMe() + { + var identity = User.Identity; + return Ok(new + { + identity?.Name, + identity?.AuthenticationType, + identity?.IsAuthenticated, + Claims = User.Claims.Select(claim => new { claim.Type, claim.Value }) + }); + } + } +} \ No newline at end of file