Hello,
I'm trying to figure out how to get the current Identity user information, basically i do the following:
- [Produces("application/json")]
- [Route("api/GetPermissions")]
- public class GetPermissionsController : Controller
- {
- private readonly ClaimsPrincipal _caller;
- //private readonly UserManager _userManager;
- //private readonly SignInManager _signInManager;
- //private readonly UserManager _manager;
- public GetPermissionsController(ClaimsPrincipal caller)
- {
- _caller = caller;
- }
- [HttpGet]
- public IActionResult getPermissions()
- {
- var x= HttpContext.Request.LogonUserIdentity.Name;
- return new JsonResult(_caller.Claims.Select(
- c => new { c.Type, c.Value }));
- }
In my scenario i want to get the username to Angular service.
Ravi Kiran ChanduriPosted Dec 12, 2017, 5:21 AM