Open Closed

How to allow one user concurrent login per user #950


User avatar
0
BennieMok created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v4.2.1
  • 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:

Hi, I want to implement this funtion, can you give me any ideas?Thanks.


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

    hi

    Add an property to User, you can use GUID. Change this value after each login and store it in current cliaims. If you find that this value has changed, it means the user is logged in again. so tyou can block login

  • User Avatar
    0
    BennieMok created

    Hi Maliming, If I want to remain the token of the current user and revoke the previous user?

  • User Avatar
    0
    BennieMok created

    I have solved it,Thanks.

  • User Avatar
    0
    learnabp created

    @BennieMok can you please share with us how you solved this ?

    Thanks in advance, I too am looking for a way to do this.

  • User Avatar
    0
    learnabp created

    @Mailing

    I have managed to add an property to User called ConCurrentUserId of type GUID, I have also created my own cutom Signin manager.

    Can you tell me:

    1. Which method I should use and
    2. How I can add a claim
    3. How I can get the claim to check the user property ConCurrentUserID, so that I can block login?
  • User Avatar
    0
    learnabp created

    hi

    Add an property to User, you can use GUID. Change this value after each login and store it in current cliaims.
    If you find that this value has changed, it means the user is logged in again. so tyou can block login

    This is not a good solution what if the user forgets to logout, the user wont be allowed to log back in if the GIU is not removed right?

    and when you say store it in the current claim what doyou mean?

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09