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

前端 未结 5 1942
借酒劲吻你
借酒劲吻你 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条回答
  •  伪装坚强ぢ
    2020-12-14 01:58

    Then in the view page

    @(((ClaimsIdentity)User.Identity).FindFirstValue("firstName"))
    

    It will show the authenticated user firstName.

    and import the following packages at the top of the page

    @using Microsoft.AspNet.Identity
    @using System.Security.Claims;
    

提交回复
热议问题