简体   繁体   中英

Windows Authentication In Angular 6 Application and ASP.Net Web API

请帮助,我无法获取User.Identity.Name,它为空,但是我也添加了system.security.principle和System.diagonstics.application。

I have also faced the same issue when using ASP.Net Core2, I have stored logged in users mail id in the claim and obtain it later from identity.

ClaimsIdentity identity = User.Identity as ClaimsIdentity;
var userMailId = identity?.FindFirst(JwtRegisteredClaimNames.Sub)?.Value;

You can store name in CLaim and retrieve it later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM