Temporary Session Based Claims in ASP.NET Core Identity

北慕城南 提交于 2019-12-07 00:26:44

问题


Adding claims in ASP.NET Core Identity is straight forward enough, but I'm having trouble finding how to add a temporary session based claim.

My use case is such that a logged in user with their own custom claims needs to periodically have a new claim added, but only for the current session, and not persisted to the database. After they close their browser or sign out, the temporary claim should go away.

This is to satisfy a mechanism that temporarily changes the organization to which a user belongs for purposes of impersonation in an application that I'm migrating to asp.net Core.

I've found lots of advice here on SO for accomplishing this via GenerateUserIdentityAsync in previous versions of Identity but that does not seem to be available in the new version.

来源:https://stackoverflow.com/questions/39312314/temporary-session-based-claims-in-asp-net-core-identity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!