Add claims on successful login and retrieve it elsewhere in the application

前端 未结 5 1943
借酒劲吻你
借酒劲吻你 2020-12-14 01:51

Please I need assistance in implementing a custom way of assigning claims to authenticated users. On successful login,

var result = await SignInManager.Pass         


        
5条回答
  •  旧时难觅i
    2020-12-14 02:03

    are you not able to access User.Identity from the view?

    To retrieve claims for a user, it's been as simple as this for me:

    var identity = (ClaimsIdentity) User.Identity

    And then accessing identity.Claims and using LINQ to retrieve specific claims.

提交回复
热议问题