Open Closed

Override token controller #5947


User avatar
0
imranStem created

I want to implement the concurrent user login and I checked many articles and found that to update the SecurityStamp to invalidate the previous login. So I want to update the security token when user login into the system

I have written below code and override the token controller.

 [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(TokenController))]
    public class MyTokenController : TokenController
    {
        protected override async Task SetSuccessResultAsync(OpenIddictRequest request, IdentityUser user)
        {
            var userManager = LazyServiceProvider.LazyGetRequiredService();
          await userManager.UpdateSecurityStampAsync(user);
            

            return await base.SetSuccessResultAsync(request, user);
        }
    }

Its updating the securityStamp on each login but token is not invalidated for previous same user login.

  • ABP Framework version: v7.0.1

  • UI Type: Angular

  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)

  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

  • Exception message and full stack trace:

  • Steps to reproduce the issue:


4 Answer(s)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 25, 2025, 11:10