Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

MVC 5 identity SignOut Everywhere for specific user

/*===================================================*/
// 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))
    }
});
/*===============================================================================*/
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# create dll runtime 
Csharp :: C# predict rotation by an angular velocity 
Csharp :: windows forms webbrowser goback 
Csharp :: Program to find GCD or HCF of two numbers c# 
Csharp :: how to unit test dbcontext in .net core 
Csharp :: stateteach.net 
Csharp :: how to mock abstract httpcontext using moq .net core 
Csharp :: C#$ 
Csharp :: aws asp.net tutorial 
Csharp :: filter enum using linq query 
Csharp :: .net ssh, wait command execute 
Csharp :: ip validation .net core 
Csharp :: pyqt single instance 
Csharp :: c# is not 
Csharp :: c# .net calculate md5 
Csharp :: screenshot c# WinForms 
Csharp :: c# get digits from int 
Csharp :: c# quaternion eular calculator 
Csharp :: ef null check 
Csharp :: c# null coalescing operator 
Csharp :: unity int to bool 
Csharp :: convert memorystream to byte array c# 
Csharp :: c# literals 
Csharp :: how to convert c# string to pdf 
Csharp :: Select records that does not exist in another table in Entity Framework 
Csharp :: xamarin 12 hrs time format tt 
Html :: stylesheet einbinden html5 
Html :: text-bold bootstrap 
Html :: materialize cdn 
Html :: input type file accept only images 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =