title: How to add additional claims to ClaimsPrincipal after ADFS authentication on MVC app
body: <p>We have an MVC 5 web app that uses ADFS 4 authentication. I'm trying to find the <strong>best place where</strong> I can add additional claims into the ClaimsPrincipal, after authentication has been completed.</p>
  
  <p>Are there any events I can access, like OnAuthenticated? How do I access this kind of event?</p>
  
  <p>This is what I intend to use once I can access the event:</p>
  
  <pre><code>IOwinContext context = Request.GetOwinContext();
  
  if (appRoles != null)
  {
      ClaimsIdentity claimsIdentity = new ClaimsIdentity(System.Web.HttpContext.Current.User.Identity);
  
      foreach (var role in appRoles)
      {
          claimsIdentity.AddClaim(new Claim("http://schemas.microsoft.com/ws/2008/06/identity/claims/role", role));
      }
  
      context.Authentication.AuthenticationResponseGrant = new AuthenticationResponseGrant
          (new ClaimsPrincipal(claimsIdentity), new AuthenticationProperties { IsPersistent = true });
  }
  </code></pre>
  
  <p><strong>EDIT:</strong>
  This is what my <code>App_Data\Startup.Auth.cs</code> file looks like:</p>
  
  <pre><code>public partial class Startup
  {
      private static string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
      private static string adfsMetadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];
  
      public void ConfigureAuth(IAppBuilder app)
      {
          app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
  
          app.UseCookieAuthentication(new CookieAuthenticationOptions
          {
              CookieManager = new SystemWebCookieManager()
          });
  
          app.UseWsFederationAuthentication(
              new WsFederationAuthenticationOptions
              {
                  Wtrealm = realm,
                  MetadataAddress = adfsMetadata
              });
      }
  }
  </code></pre>