よく分かりました。私はGoolge's Federated Log API groupに質問を掲示し、Attribute exchangeを使用するように言われました。
以下はDotNetOpenAuthのコードです。
このコードは本番環境では使用しないでください。これは説明のためのものです!
要求:
using (OpenIdRelyingParty openid = new OpenIdRelyingParty())
{
IAuthenticationRequest request = openid.CreateRequest(openidurl);
var fetch = new FetchRequest();
fetch.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
request.AddExtension(fetch);
// Send your visitor to their Provider for authentication.
request.RedirectToProvider();
}
応答:私は、応答がnullのフルネームを取得しようとすると、完全な名前を取得するためのソリューションを提供してください
OpenIdRelyingParty openid = new OpenIdRelyingParty();
var response = openid.GetResponse();
if (response != null)
{
switch (response.Status)
{
case AuthenticationStatus.Authenticated:
{
var fetch = response.GetExtension<FetchResponse>();
string email = string.Empty();
if (fetch != null)
{
email = fetch.GetAttributeValue(
WellKnownAttributes.Contact.Email);
}
FormsAuthentication.RedirectFromLoginPage(
response.ClaimedIdentifier, false);
break;
}
...
}
}
これは素晴らしいです。プロバイダ名を取得する方法も知っていますか(回答の分析は別として)? –
要求されたIDですか? ケースAuthenticationStatus.Authenticated: { string identifier = response.ClaimedIdentifier; } – Rob
私は彼がプロバイダの実際のフレンドリーな名前、すなわち「Google」「Facebook」のレスポンスを解析する必要があるという話をしていたと思います。 – Brian