I'm using ASP.NET Core 2.0 and Microsoft.AspNetCore.Identity 2.0.1
In a class, actually in context, I need to retrieve the logged-in user ID. in the old one, I would:
var userId = User.Identity.GetUserId();
Now in ASP.NET CORE, if I were in a controller, I saw that I could easily recover with:
var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
The problem is how to achieve this in a Class? I searched all over StackOverflow and nda, at most I found solution pro beta 1.0 that does not work or adding the old ASPNET.Identity.