我已按照该链接创建Azure AD身份访问身份验证。
我按照上面的链接在索赔页面上检索了以下信息。
IsAuthenticated:True
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier * ** * ** * ** http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider uri:WindowsLiveID http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant *
但我希望微软登录帐户信息,如姓名或电子邮件。无法在我的localhost检索信息。
答案 0 :(得分:1)
public ActionResult Index()
{
ClaimsPrincipal cp = ClaimsPrincipal.Current;
string fullname =
string.Format("{0} {1}", cp.FindFirst(ClaimTypes.GivenName).Value,
cp.FindFirst(ClaimTypes.Surname).Value);
ViewBag.Message = string.Format("Dear {0}, welcome to the Expense Note App",
fullname);
return View();
}
答案 1 :(得分:0)
Microsoft帐户(AKA LiveID)不向ACS提供用户的个人信息或电子邮件,您只能获得代表用户的ID。 Google ID会为您提供用户名和电子邮件。
按设计,不能更改。