Exemplo n.º 1
0
 public IActionResult Index()
 {
     if (User.Identity.IsAuthenticated)
     {
         List <System.Security.Claims.Claim> c1 = User.Claims.Where(x => x.Type.Contains("mail")).ToList();
         List <System.Security.Claims.Claim> c2 = User.Claims.Where(x => x.Type.Contains("givenname")).ToList();
         List <System.Security.Claims.Claim> c3 = User.Claims.Where(x => x.Type.Contains("surname")).ToList();
         string email   = c1[0].Value;
         string name    = c2[0].Value;
         string surname = c3[0].Value;
         context.AddUserIfNotExists(name, surname, email);
     }
     return(View());
 }