protected JWTAuthenticationIdentity GetJWTIdentity() { if (User?.Identity == null) { return(null); } return(AuthenticationModule.PopulateUser(User.Identity as ClaimsIdentity)); }
public WeatherForecast Get(int id) { JWTAuthenticationIdentity jwtUser = AuthenticationModule.PopulateUser(HttpContext.User.Identity as ClaimsIdentity); Console.WriteLine($"WeatherForecastController.Get, jwtUser.Name={jwtUser.Name}"); LogManager.GetLogger().Info($"WeatherForecastController.Get, jwtUser.Name={jwtUser.Name}"); var rng = new Random(); return(new WeatherForecast { Date = DateTime.Now.AddDays(2), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)], Roles = String.Join(",", jwtUser.Roles), Email = jwtUser.Mail, Classe = jwtUser.Classe }); }