title: Refreshing user roles in ASP.NET Identity at a certain point
body: <p>I have implemented role-based authentication/authorization on my website using ASP.NET Identity &amp; Owin using the following code:</p>
  
  <pre><code> [HttpPost]
          [ActionName("Login")]
          public ActionResult Login(LoginViewModel model)
          {
              if (ModelState.IsValid)
              {
                  var user = ctx.Users.Where(x =&gt; x.Email == model.Username).FirstOrDefault();
                  if (user != null)
                  {
                      if (user.PasswordHash == Helpers.PasswordHelper.CreatePasswordHash(model.Password, user.PasswordSalt))
                      {
                          ClaimsIdentity identity = new ClaimsIdentity(DefaultAuthenticationTypes.ApplicationCookie);
                          identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, model.Username));
                          List&lt;Claim&gt; claims = new List&lt;Claim&gt;();
                          var roles = user.UserRoles.Where(x =&gt; x.UserId == user.UserId).ToList();
                          foreach (var item in roles)
                          {
                              claims.Add(new Claim(ClaimTypes.Role, item.Roles.RoleName));
                          }
                          identity.AddClaims(claims);                     
                          identity.AddClaim(new Claim(ClaimTypes.Name, model.Username));
  
                          AuthenticationManager.SignIn(identity);
  
                          return RedirectToAction("Index", "Index");
                      }
                  }
                  ModelState.AddModelError("WrongUsernamePassword", "Wrong username or password!");
                  return View("Login", model);
              }
              else
              {
                  return View("Login",model);
              }
          }
  </code></pre>
  
  <p>My question is, is there  a way for me now to refresh the user roles when they are changed in the DB?? </p>
  
  <p>What could I do to achieve this ?</p>