Open Closed

How to restrict the number of connections per User Account #4933


User avatar
0
david.hurtado created

We need to know if it is possible to restrict the number of concurrent logins that the same user can make in the application.

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

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    We did not implement this function in ABP.

    I can give you some idea

    • When the user logins you can add a random GUID value to the claims, and store the GUID in the cache(can be a list, if you want to limit to allow only three concurrent logins, then the length of the list is 3 : https://docs.abp.io/en/abp/latest/Authorization#claims-principal-factory
    • Write an ASPNETCORE middleware to check the current user's claims, if the GUID value is not in the allowed list, return unauthorized
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11