diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-19 21:53:49 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-19 21:53:49 -0800 |
commit | adb907a28951e4bafd29d9c02582a90d7df48b06 (patch) | |
tree | fc0eaf6ef054c46c846cd785b108dfba51f68738 /src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCode.cs | |
parent | 339d48e68b86344bb611ed1db1050d8c2f569927 (diff) | |
download | DotNetOpenAuth-adb907a28951e4bafd29d9c02582a90d7df48b06.zip DotNetOpenAuth-adb907a28951e4bafd29d9c02582a90d7df48b06.tar.gz DotNetOpenAuth-adb907a28951e4bafd29d9c02582a90d7df48b06.tar.bz2 |
Removed requirement for callback parameter, per the spec.
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCode.cs')
-rw-r--r-- | src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCode.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCode.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCode.cs index ad9730a..6199178 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCode.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/AuthorizationCode.cs @@ -33,12 +33,11 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// Initializes a new instance of the <see cref="AuthorizationCode"/> class. /// </summary> /// <param name="clientIdentifier">The client identifier.</param> - /// <param name="callback">The callback the client used to obtain authorization.</param> + /// <param name="callback">The callback the client used to obtain authorization, if one was explicitly included in the request.</param> /// <param name="scopes">The authorized scopes.</param> /// <param name="username">The name on the account that authorized access.</param> internal AuthorizationCode(string clientIdentifier, Uri callback, IEnumerable<string> scopes, string username) { Requires.NotNullOrEmpty(clientIdentifier, "clientIdentifier"); - Requires.NotNull(callback, "callback"); this.ClientIdentifier = clientIdentifier; this.CallbackHash = CalculateCallbackHash(callback); @@ -96,6 +95,10 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// </returns> [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "False positive.")] private static byte[] CalculateCallbackHash(Uri callback) { + if (callback == null) { + return null; + } + using (var hasher = new SHA256Managed()) { return hasher.ComputeHash(Encoding.UTF8.GetBytes(callback.AbsoluteUri)); } |