I'm using JWT with .Net Core 2.1, and the
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
decorator on my controller class. In 2.0 it seemed you had to do something like the following, but it's now marked as obsolete:
var authenticateInfo = await HttpContext.Authentication.GetAuthenticateInfoAsync("Bearer");
string accessToken = authenticateInfo.Properties.Items[".Token.access_token"];
I've seen some other fairly circuitous methods of extending authorisation classes and the like which I'd rather avoid. I simply want to access the particulars of the token much as I'd encoded them, eg the .Sub, and custom claims I've added like "Name" and "Roles". How to do so in .Net Core 2.1?