diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-08-25 21:05:34 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-08-25 21:35:29 -0700 |
commit | f73ea29363fcb0574cf257706dc92942da91d435 (patch) | |
tree | c809d607d8ea3228445d3eb77c5864ca75a4da63 /src | |
parent | 76451f71f7203beec121bc3e11d4cc769002d567 (diff) | |
download | DotNetOpenAuth-f73ea29363fcb0574cf257706dc92942da91d435.zip DotNetOpenAuth-f73ea29363fcb0574cf257706dc92942da91d435.tar.gz DotNetOpenAuth-f73ea29363fcb0574cf257706dc92942da91d435.tar.bz2 |
Fixed up OpenIdTextBox so it doesn't add an sreg request with an empty list of fields.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs index dafefca..be95ed6 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs @@ -255,6 +255,11 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { #endregion /// <summary> + /// An empty sreg request, used to compare with others to see if they too are empty. + /// </summary> + private static readonly ClaimsRequest EmptyClaimsRequest = new ClaimsRequest(); + + /// <summary> /// Initializes a new instance of the <see cref="OpenIdTextBox"/> class. /// </summary> public OpenIdTextBox() { @@ -647,7 +652,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { private void AddProfileArgs(IAuthenticationRequest request) { ErrorUtilities.VerifyArgumentNotNull(request, "request"); - request.AddExtension(new ClaimsRequest() { + var sreg = new ClaimsRequest() { Nickname = this.RequestNickname, Email = this.RequestEmail, FullName = this.RequestFullName, @@ -659,7 +664,12 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { TimeZone = this.RequestTimeZone, PolicyUrl = string.IsNullOrEmpty(this.PolicyUrl) ? null : new Uri(this.RelyingParty.Channel.GetRequestFromContext().UrlBeforeRewriting, this.Page.ResolveUrl(this.PolicyUrl)), - }); + }; + + // Only actually add the extension request if fields are actually being requested. + if (!sreg.Equals(EmptyClaimsRequest)) { + request.AddExtension(sreg); + } } } } |