Open Closed

How to change SecurityStamp response message? #9054


0
inventiskr created

I set "AllowOneConcurrentLoginPerUser" to true for not allow the duplicate login. So first token get failed checking after seconde login and client always receive 401 StatusCode, with message "Current user did not login to system". I want to modify 'UserFriendlyException' message like 'A duplicate login has been detected. Your connection to the server has been lost. Access time : 11AM / IP : 192.168.0.1'. How to change response message when duplicate login?


1 Answer(s)
  • 0
    maliming created
    Support Team

    hi

    You can consider storing the information in current request/httpcontext.items or somewhere in the ValidateSecurityStampAsync method. Then rewrite AbpExceptionFilter(https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs#L73) to try to read the information you stored. And return it.