Starts in:
2 DAYS
9 HRS
6 MIN
31 SEC
Starts in:
2 D
9 H
6 M
31 S
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 v9.1.0-preview. Updated on November 20, 2024, 13:06