diff options
Diffstat (limited to 'src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs')
-rw-r--r-- | src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs | 76 |
1 files changed, 35 insertions, 41 deletions
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs index 4a29111..dcf6a13 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs @@ -1,48 +1,42 @@ -using System.Collections.Generic; -using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; -using DotNetOpenAuth.OpenId.RelyingParty; +namespace DotNetOpenAuth.AspNet.Clients { + using System.Collections.Generic; + using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; + using DotNetOpenAuth.OpenId.RelyingParty; -namespace DotNetOpenAuth.AspNet.Clients -{ - public sealed class YahooOpenIdClient : OpenIDClient - { - public YahooOpenIdClient() : - base("yahoo", "http://me.yahoo.com") - { - } + public sealed class YahooOpenIdClient : OpenIDClient { + public YahooOpenIdClient() : + base("yahoo", "http://me.yahoo.com") { + } - /// <summary> - /// Called just before the authentication request is sent to service provider. - /// </summary> - /// <param name="request">The request.</param> - protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request) - { - // Attribute Exchange extensions - var fetchRequest = new FetchRequest(); - fetchRequest.Attributes.Add(new AttributeRequest(WellKnownAttributes.Contact.Email, isRequired: true)); - fetchRequest.Attributes.Add(new AttributeRequest(WellKnownAttributes.Name.FullName, isRequired: false)); + /// <summary> + /// Called just before the authentication request is sent to service provider. + /// </summary> + /// <param name="request">The request.</param> + protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request) { + // Attribute Exchange extensions + var fetchRequest = new FetchRequest(); + fetchRequest.Attributes.Add(new AttributeRequest(WellKnownAttributes.Contact.Email, isRequired: true)); + fetchRequest.Attributes.Add(new AttributeRequest(WellKnownAttributes.Name.FullName, isRequired: false)); - request.AddExtension(fetchRequest); - } + request.AddExtension(fetchRequest); + } - /// <summary> - /// Gets the extra data obtained from the response message when authentication is successful. - /// </summary> - /// <param name="response">The response message.</param> - /// <returns></returns> - protected override Dictionary<string, string> GetExtraData(IAuthenticationResponse response) - { - FetchResponse fetchResponse = response.GetExtension<FetchResponse>(); - if (fetchResponse != null) - { - var extraData = new Dictionary<string, string>(); - extraData.AddItemIfNotEmpty("email", fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email)); - extraData.AddItemIfNotEmpty("fullName", fetchResponse.GetAttributeValue(WellKnownAttributes.Name.FullName)); + /// <summary> + /// Gets the extra data obtained from the response message when authentication is successful. + /// </summary> + /// <param name="response">The response message.</param> + /// <returns></returns> + protected override Dictionary<string, string> GetExtraData(IAuthenticationResponse response) { + FetchResponse fetchResponse = response.GetExtension<FetchResponse>(); + if (fetchResponse != null) { + var extraData = new Dictionary<string, string>(); + extraData.AddItemIfNotEmpty("email", fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email)); + extraData.AddItemIfNotEmpty("fullName", fetchResponse.GetAttributeValue(WellKnownAttributes.Name.FullName)); - return extraData; - } + return extraData; + } - return null; - } - } + return null; + } + } } |