Open Closed

Concurrent user login in Microservice Template #4080


User avatar
0
imranStem created

I want to integrate the concurrent login feature. I downloaded the sample code from GitHub. I have a microservice template. What is the best practice to integrate the concurrent login feature, with Auth Server or Identity service or any other way?

  • ABP Framework version: v6.0.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ? I downloaded the sample code from GitHub.

    What is the sample? Can you share the Github URL?

  • User Avatar
    0
    imranStem created

    https://github.com/abpframework/abp-samples/tree/master/ConcurrentLogin

    But this sample is integrated with the identity server 4 and the microservice template has OpenID configuration.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    For openiddict

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(TokenController))]
    class MyTokenController : TokenController
    {
        protected override async Task<IActionResult> SetSuccessResultAsync(OpenIddictRequest request, IdentityUser user)
        {
            var userManager = LazyServiceProvider.LazyGetRequiredService<IdentityUserManager>();
            user.SetProperty(ConcurrentLoginConsts.ConcurrentLoginToken, Guid.NewGuid().ToString("N"));
            await UserManager.UpdateAsync(user);
    
            return await base.SetSuccessResultAsync(request, user);
        }
    }
    

    https://github.com/abpframework/abp/blob/a4aba09dc909006ea188f322e73cf56f56fe4616/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs#L213

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15