How to refresh claim of a different user than the one logged in during the current request?

后端 未结 1 1141
无人及你
无人及你 2021-01-20 15:09

I use the following code to update the claims of a user in my web application. However, to update the claims/cookie of this user, I want to force him to login again. So esse

相关标签:
1条回答
  • 2021-01-20 15:35

    After searching a few days I discovered that what I want is not possible. You cannot force logging the user out without putting the cookie timespan to 0

    options.Cookies.ApplicationCookie.ExpireTimeSpan = 0;

    In this case it will check the cookie every time the user makes a request. With the following code you can than force the user to login again:

    await _userManager.UpdateSecurityStampAsync(user);

    0 讨论(0)
提交回复
热议问题