MVC 5 Identity Seturt em todos os lugares para usuário específico
/*===================================================*/
// Using this line in action after get the user
/*===================================================*/
await UserManager.UpdateSecurityStampAsync(user.Id);
/*===================================================*/
/*===============================================================================*/
// Add this code in Startup.Auth.cs or update (validateInterval) if code exist
/*===============================================================================*/
// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Admin/Admins/Login"),
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromSeconds(10), // <=== Update this SignOut after 10sec
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
/*===============================================================================*/
Amr Moniem