Ventan00 / quanda

quanda is a service for questions and answers
Apache License 2.0
2 stars 0 forks source link

Fixed IdUser attachment to HttpContext #64

Closed pnarozniak closed 3 years ago

pnarozniak commented 3 years ago

Now there is new way to get user id from httpcontext. There is object called User in HttpContext which have user all claim principals pulled out from JWT. Example:

TestController.cs: [HttpGet] public IActionResult Test() { var id = HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier); OR var id = HttpContext.User.GetId(); return Ok(id); }

close #61