我正在为我的应用程序使用Window platform,我试图从他们在google/yahoo的帐户中获取用户的信息。
但我通过Azure的输入/输出claims...Can获得的信息只有他们的姓名、电子邮件地址和身份提供商当他们在谷歌/雅虎注册时,有人帮我获取他们的国家或手机号码
下面是我获取声明的示例代码:
protected void Page_Load(object sender, EventArgs e)
{
{
ClaimsPrincipal icp = Thread.CurrentPrincipal as ClaimsPrincipal;
ClaimsIdentity claimsidentity = icp.Identity as ClaimsIdentity;
string email = "", name = "", idprovider = "" ;
foreach (Claim c in claimsidentity.Claims)
{
if (c.ClaimType == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress")
{
email = c.Value;
}
if (c.ClaimType == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name")
{
name = c.Value;
}
if (c.ClaimType == "http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider")
{
idprovider = c.Value;
}
}
Label1.Text = (name + email + idprovider);当我编辑我的规则时,ClaimsPrincipal没有将国家/手机号值计算到其account....PLZ帮助中!
发布于 2013-03-04 17:58:44
据我所知--不是直接的,应该是这样的!
当用户同意在您的应用程序中提供他或她的身份时,他们不一定,当然也不会明确同意与您共享配置文件信息,因此身份提供商真的不应该这样做。
在我看来,一些提供商已经提供了太多--我不会期望他们只共享GUID,就像微软一样。例如,谷歌共享名称和电子邮件地址,而我不一定想要允许这样做。很多时候,我宁愿保留我的gmail电子邮件地址的私密性,并为我正在登录的应用程序提供一个不同的地址,或者根本不提供。
简而言之,如果你想要任何关于用户的信息,你应该向他们索要,而不是从其他地方获得。
有关此视图的更多信息,如果感兴趣,请单击此处- http://yossidahan.wordpress.com/2012/02/19/end-to-end-authentication-and-authorisation-scenario-for-mvcacs/
https://stackoverflow.com/questions/15196917
复制相似问题