VisualBean
12/12/2017 - 7:42 AM

MySuperImportantService.cs

public class MySuperImportantService
{
  private ClaimsPrincipal _user;
  public MySuperImportantService(ClaimsPrincipal user)
  {
    this._user = user;
  }
  
  public string SuperImportantMethod()
  {
    //Do super important stuff
    string username = _user.Identity.Name; //or _user.FindFirst("nameidentifier");
    //Do stuff with username.
  }
}