diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-26 12:52:06 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-26 12:52:06 -0700 |
commit | b9ae2ab289e2b9708ea3cce055ac484b00246a8a (patch) | |
tree | 28ef380a84c743075cbddf3417556e1d1bb37f49 | |
parent | 3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb (diff) | |
download | DotNetOpenAuth-b9ae2ab289e2b9708ea3cce055ac484b00246a8a.zip DotNetOpenAuth-b9ae2ab289e2b9708ea3cce055ac484b00246a8a.tar.gz DotNetOpenAuth-b9ae2ab289e2b9708ea3cce055ac484b00246a8a.tar.bz2 |
Lots of StyleCop fixes.
62 files changed, 314 insertions, 260 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs index 16f1c92..7c9f678 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs +++ b/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs @@ -154,7 +154,7 @@ namespace DotNetOpenAuth.ApplicationBlock { } public async Task<JArray> GetUpdatesAsync(AccessToken accessToken, CancellationToken cancellationToken = default(CancellationToken)) { - if (String.IsNullOrEmpty(accessToken.Token)) { + if (string.IsNullOrEmpty(accessToken.Token)) { throw new ArgumentNullException("accessToken.Token"); } @@ -169,7 +169,7 @@ namespace DotNetOpenAuth.ApplicationBlock { } public async Task<XDocument> GetFavorites(AccessToken accessToken, CancellationToken cancellationToken = default(CancellationToken)) { - if (String.IsNullOrEmpty(accessToken.Token)) { + if (string.IsNullOrEmpty(accessToken.Token)) { throw new ArgumentNullException("accessToken.Token"); } diff --git a/samples/OAuthClient/WindowsLive.aspx.cs b/samples/OAuthClient/WindowsLive.aspx.cs index efe41ec..a3725e9 100644 --- a/samples/OAuthClient/WindowsLive.aspx.cs +++ b/samples/OAuthClient/WindowsLive.aspx.cs @@ -33,9 +33,7 @@ await client.ProcessUserAuthorizationAsync(new HttpRequestWrapper(Request), Response.ClientDisconnectedToken); if (authorization == null) { // Kick off authorization request - var request = - await client.PrepareRequestUserAuthorizationAsync(scopes: new[] { WindowsLiveClient.Scopes.Basic }); - // this scope isn't even required just to log in + var request = await client.PrepareRequestUserAuthorizationAsync(scopes: new[] { WindowsLiveClient.Scopes.Basic }); // this scope isn't even required just to log in await request.SendAsync(new HttpContextWrapper(this.Context), Response.ClientDisconnectedToken); this.Context.Response.End(); } else { diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml.cs b/samples/OAuthConsumerWpf/MainWindow.xaml.cs index d58df8c..c813576 100644 --- a/samples/OAuthConsumerWpf/MainWindow.xaml.cs +++ b/samples/OAuthConsumerWpf/MainWindow.xaml.cs @@ -176,7 +176,7 @@ authorizePopup.Authorization.Scope.AddRange(OAuthUtilities.SplitScopes(this.oauth2ScopeBox.Text)); authorizePopup.Authorization.Callback = new Uri("http://www.microsoft.com/en-us/default.aspx"); authorizePopup.Owner = this; - authorizePopup.ClientAuthorizationView.RequestImplicitGrant = flowBox.SelectedIndex == 1; + authorizePopup.ClientAuthorizationView.RequestImplicitGrant = this.flowBox.SelectedIndex == 1; bool? result = authorizePopup.ShowDialog(); if (result.HasValue && result.Value) { var request = new HttpRequestMessage( diff --git a/samples/OAuthServiceProvider/Code/Global.cs b/samples/OAuthServiceProvider/Code/Global.cs index 37206ab..6f04a55 100644 --- a/samples/OAuthServiceProvider/Code/Global.cs +++ b/samples/OAuthServiceProvider/Code/Global.cs @@ -10,10 +10,6 @@ /// The web application global events and properties. /// </summary> public class Global : HttpApplication { - private readonly object syncObject = new object(); - - private volatile bool initialized; - /// <summary> /// An application memory cache of recent log messages. /// </summary> @@ -24,6 +20,10 @@ /// </summary> public static log4net.ILog Logger = log4net.LogManager.GetLogger("DotNetOpenAuth.OAuthServiceProvider"); + private readonly object syncObject = new object(); + + private volatile bool initialized; + /// <summary> /// Gets the transaction-protected database connection for the current request. /// </summary> diff --git a/samples/OpenIdOfflineProvider/MainWindow.xaml.cs b/samples/OpenIdOfflineProvider/MainWindow.xaml.cs index 2297a2a..dc3a500 100644 --- a/samples/OpenIdOfflineProvider/MainWindow.xaml.cs +++ b/samples/OpenIdOfflineProvider/MainWindow.xaml.cs @@ -20,6 +20,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { using System.Threading; using System.Threading.Tasks; using System.Web; + using System.Web.Http; using System.Web.Http.Routing; using System.Web.Http.SelfHost; using System.Windows; @@ -39,13 +40,16 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { using log4net.Core; using Validation; - using System.Web.Http; - /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window, IDisposable { /// <summary> + /// The main window for the app. + /// </summary> + internal static MainWindow Instance; + + /// <summary> /// The logger the application may use. /// </summary> private ILog logger = log4net.LogManager.GetLogger(typeof(MainWindow)); @@ -69,8 +73,6 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { this.StartProviderAsync(); } - internal static MainWindow Instance; - #region IDisposable Members /// <summary> @@ -155,6 +157,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { /// <summary> /// Starts the provider. /// </summary> + /// <returns>A task that completes when the asynchronous operation is finished.</returns> private async Task StartProviderAsync() { Exception exception = null; try { @@ -199,6 +202,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { /// <summary> /// Stops the provider. /// </summary> + /// <returns>A task that completes when the asynchronous operation is finished.</returns> private async Task StopProviderAsync() { if (this.hostServer != null) { await this.hostServer.CloseAsync(); diff --git a/samples/OpenIdOfflineProvider/Settings.StyleCop b/samples/OpenIdOfflineProvider/Settings.StyleCop index 5042032..997156d 100644 --- a/samples/OpenIdOfflineProvider/Settings.StyleCop +++ b/samples/OpenIdOfflineProvider/Settings.StyleCop @@ -1,4 +1,4 @@ -<StyleCopSettings Version="4.3"> +<StyleCopSettings Version="105"> <Analyzers> <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules"> <Rules> @@ -7,11 +7,6 @@ <BooleanProperty Name="Enabled">True</BooleanProperty> </RuleSettings> </Rule> - <Rule Name="ElementsMustBeDocumented"> - <RuleSettings> - <BooleanProperty Name="Enabled">True</BooleanProperty> - </RuleSettings> - </Rule> </Rules> <AnalyzerSettings /> </Analyzer> diff --git a/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.cs b/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.cs index d1b1413..d955f36 100644 --- a/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.cs +++ b/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.cs @@ -80,8 +80,7 @@ response.ClaimedIdentifier, DateTime.Now, DateTime.Now.AddMinutes(TimeoutInMinutes), - false, - // non-persistent, since login is automatic and we wanted updated roles + false, // non-persistent, since login is automatic and we wanted updated roles string.Join(";", roles.ToArray())); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket)); diff --git a/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs b/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs index ad5a69d..cfb0552 100644 --- a/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs +++ b/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs @@ -8,11 +8,11 @@ namespace DotNetOpenAuth.AspNet.Test { using System; using System.Collections.Generic; using System.Collections.Specialized; + using System.Threading.Tasks; using System.Web; using DotNetOpenAuth.AspNet.Clients; using Moq; using NUnit.Framework; - using System.Threading.Tasks; [TestFixture] public class OAuth2ClientTest { diff --git a/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs b/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs index 25dd50b..d8686ae 100644 --- a/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs +++ b/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs @@ -7,16 +7,16 @@ namespace DotNetOpenAuth.AspNet.Test { using System; using System.Collections.Specialized; + using System.Threading; + using System.Threading.Tasks; using System.Web; using DotNetOpenAuth.AspNet; using DotNetOpenAuth.AspNet.Clients; using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OAuth; using DotNetOpenAuth.OAuth.Messages; using Moq; using NUnit.Framework; - using DotNetOpenAuth.OAuth; - using System.Threading; - using System.Threading.Tasks; [TestFixture] public class OAuthClientTest { diff --git a/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs b/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs index 4493288..c7def96 100644 --- a/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs +++ b/src/DotNetOpenAuth.AspNet/AuthenticationResult.cs @@ -7,9 +7,9 @@ namespace DotNetOpenAuth.AspNet { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using DotNetOpenAuth.Messaging; - using System.Collections.Specialized; /// <summary> /// Represents the result of OAuth or OpenID authentication. diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs index 1b6318f..3a7d60f 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs @@ -34,14 +34,11 @@ namespace DotNetOpenAuth.AspNet.Clients { #region Constructors and Destructors /// <summary> - /// Initializes a new instance of the <see cref="DotNetOpenAuthWebConsumer"/> class. + /// Initializes a new instance of the <see cref="DotNetOpenAuthWebConsumer" /> class. /// </summary> - /// <param name="serviceDescription"> - /// The service description. - /// </param> - /// <param name="tokenManager"> - /// The token manager. - /// </param> + /// <param name="serviceDescription">The service description.</param> + /// <param name="consumerKey">The consumer key.</param> + /// <param name="consumerSecret">The consumer secret.</param> public DotNetOpenAuthWebConsumer(ServiceProviderDescription serviceDescription, string consumerKey, string consumerSecret) { Requires.NotNull(serviceDescription, "serviceDescription"); @@ -56,7 +53,7 @@ namespace DotNetOpenAuth.AspNet.Clients { #endregion /// <summary> - /// Gets the DotNetOpenAuth <see cref="WebConsumer"/> instance that can be used to make OAuth 1.0 authorized HTTP requests. + /// Gets the DotNetOpenAuth <see cref="Consumer"/> instance that can be used to make OAuth 1.0 authorized HTTP requests. /// </summary> public Consumer Consumer { get { return this.webConsumer; } @@ -68,6 +65,7 @@ namespace DotNetOpenAuth.AspNet.Clients { /// Creates an HTTP message handler that authorizes outgoing web requests. /// </summary> /// <param name="accessToken">The access token.</param> + /// <returns>An <see cref="HttpMessageHandler"/> that applies the access token to all outgoing requests.</returns> public HttpMessageHandler CreateMessageHandler(AccessToken accessToken) { Requires.NotNullOrEmpty(accessToken.Token, "accessToken"); @@ -77,6 +75,7 @@ namespace DotNetOpenAuth.AspNet.Clients { /// <summary> /// The process user authorization. /// </summary> + /// <param name="context">The HTTP context.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The response message. diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs index e3ee3e8..719e520 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs @@ -23,11 +23,13 @@ namespace DotNetOpenAuth.AspNet.Clients { /// Creates an HTTP message handler that authorizes outgoing web requests. /// </summary> /// <param name="accessToken">The access token.</param> + /// <returns>An <see cref="HttpMessageHandler"/> that applies the access token to all outgoing requests.</returns> HttpMessageHandler CreateMessageHandler(AccessToken accessToken); /// <summary> /// The process user authorization. /// </summary> + /// <param name="context">The HTTP context.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The access token, if obtained; otherwise <c>null</c>. diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs index daf3441..c758c9c 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/LinkedInClient.cs @@ -7,6 +7,7 @@ namespace DotNetOpenAuth.AspNet.Clients { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Net; @@ -18,7 +19,6 @@ namespace DotNetOpenAuth.AspNet.Clients { using DotNetOpenAuth.OAuth; using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.OAuth.Messages; - using System.Collections.Specialized; /// <summary> /// Represents LinkedIn authentication client. diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs index 1841ef3..6189446 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs @@ -7,6 +7,7 @@ namespace DotNetOpenAuth.AspNet.Clients { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Threading; @@ -19,7 +20,6 @@ namespace DotNetOpenAuth.AspNet.Clients { using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.OAuth.Messages; using Validation; - using System.Collections.Specialized; /// <summary> /// Represents base class for OAuth 1.0 clients @@ -28,17 +28,12 @@ namespace DotNetOpenAuth.AspNet.Clients { #region Constructors and Destructors /// <summary> - /// Initializes a new instance of the <see cref="OAuthClient"/> class. + /// Initializes a new instance of the <see cref="OAuthClient" /> class. /// </summary> - /// <param name="providerName"> - /// Name of the provider. - /// </param> - /// <param name="serviceDescription"> - /// The service Description. - /// </param> - /// <param name="tokenManager"> - /// The token Manager. - /// </param> + /// <param name="providerName">Name of the provider.</param> + /// <param name="serviceDescription">The service Description.</param> + /// <param name="consumerKey">The consumer key.</param> + /// <param name="consumerSecret">The consumer secret.</param> protected OAuthClient( string providerName, ServiceProviderDescription serviceDescription, string consumerKey, string consumerSecret) : this(providerName, new DotNetOpenAuthWebConsumer(serviceDescription, consumerKey, consumerSecret)) { diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs index 0c17ed3..7e80cad 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs @@ -7,6 +7,7 @@ namespace DotNetOpenAuth.AspNet.Clients { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Net; @@ -18,7 +19,6 @@ namespace DotNetOpenAuth.AspNet.Clients { using DotNetOpenAuth.OAuth; using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.OAuth.Messages; - using System.Collections.Specialized; /// <summary> /// Represents a Twitter client diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs index c06c1dc..d595b4f 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/FacebookClient.cs @@ -7,12 +7,12 @@ namespace DotNetOpenAuth.AspNet.Clients { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using System.Net; using System.Web; using DotNetOpenAuth.Messaging; using Validation; - using System.Collections.Specialized; /// <summary> /// The facebook client. diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs index b9c4941..e6642da 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/MicrosoftClient.cs @@ -7,11 +7,11 @@ namespace DotNetOpenAuth.AspNet.Clients { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.IO; using System.Net; using DotNetOpenAuth.Messaging; using Validation; - using System.Collections.Specialized; /// <summary> /// The Microsoft account client. diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs index 8e6b5f3..a795184 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth2/OAuth2Client.cs @@ -7,15 +7,13 @@ namespace DotNetOpenAuth.AspNet.Clients { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using System.Web; - using DotNetOpenAuth.Messaging; - using Validation; - using System.Collections.Specialized; /// <summary> /// Represents the base class for OAuth 2.0 clients diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs index 2a68bd8..bb6e391 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OpenID/GoogleOpenIdClient.cs @@ -6,9 +6,9 @@ namespace DotNetOpenAuth.AspNet.Clients { using System.Collections.Generic; + using System.Collections.Specialized; using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.RelyingParty; - using System.Collections.Specialized; /// <summary> /// Represents Google OpenID client. diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs index 901741b..5a5e696 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs @@ -7,6 +7,7 @@ namespace DotNetOpenAuth.AspNet.Clients { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -15,7 +16,6 @@ namespace DotNetOpenAuth.AspNet.Clients { using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.RelyingParty; using Validation; - using System.Collections.Specialized; /// <summary> /// Base classes for OpenID clients. diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs index d282d4f..a5ee6b7 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OpenID/YahooOpenIdClient.cs @@ -6,9 +6,9 @@ namespace DotNetOpenAuth.AspNet.Clients { using System.Collections.Generic; + using System.Collections.Specialized; using DotNetOpenAuth.OpenId.Extensions.AttributeExchange; using DotNetOpenAuth.OpenId.RelyingParty; - using System.Collections.Specialized; /// <summary> /// The yahoo open id client. diff --git a/src/DotNetOpenAuth.Core/Messaging/Bindings/HardCodedKeyCryptoKeyStore.cs b/src/DotNetOpenAuth.Core/Messaging/Bindings/HardCodedKeyCryptoKeyStore.cs index c828616..9bea16f 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Bindings/HardCodedKeyCryptoKeyStore.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Bindings/HardCodedKeyCryptoKeyStore.cs @@ -55,7 +55,7 @@ namespace DotNetOpenAuth.Messaging.Bindings { /// </returns> public CryptoKey GetKey(string bucket, string handle) { if (handle == HardCodedKeyHandle) { - return OneCryptoKey; + return this.OneCryptoKey; } return null; @@ -69,7 +69,7 @@ namespace DotNetOpenAuth.Messaging.Bindings { /// A sequence of handles and keys, ordered by descending <see cref="CryptoKey.ExpiresUtc" />. /// </returns> public IEnumerable<KeyValuePair<string, CryptoKey>> GetKeys(string bucket) { - return new[] { new KeyValuePair<string, CryptoKey>(HardCodedKeyHandle, OneCryptoKey) }; + return new[] { new KeyValuePair<string, CryptoKey>(HardCodedKeyHandle, this.OneCryptoKey) }; } /// <summary> @@ -78,7 +78,7 @@ namespace DotNetOpenAuth.Messaging.Bindings { /// <param name="bucket">The name of the bucket to store the key in. Case sensitive.</param> /// <param name="handle">The handle to the key, unique within the bucket. Case sensitive.</param> /// <param name="key">The key to store.</param> - /// <exception cref="System.NotSupportedException"></exception> + /// <exception cref="System.NotSupportedException">Always thrown.</exception> public void StoreKey(string bucket, string handle, CryptoKey key) { throw new NotSupportedException(); } @@ -88,7 +88,7 @@ namespace DotNetOpenAuth.Messaging.Bindings { /// </summary> /// <param name="bucket">The bucket name. Case sensitive.</param> /// <param name="handle">The key handle. Case sensitive.</param> - /// <exception cref="System.NotSupportedException"></exception> + /// <exception cref="System.NotSupportedException">Always thrown.</exception> public void RemoveKey(string bucket, string handle) { throw new NotSupportedException(); } diff --git a/src/DotNetOpenAuth.Core/Messaging/Channel.cs b/src/DotNetOpenAuth.Core/Messaging/Channel.cs index 9414166..0ffe2a6 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Channel.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Channel.cs @@ -221,6 +221,22 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> + /// Gets or sets the outgoing message filter. + /// </summary> + /// <value> + /// The outgoing message filter. + /// </value> + internal Action<IProtocolMessage> OutgoingMessageFilter { get; set; } + + /// <summary> + /// Gets or sets the incoming message filter. + /// </summary> + /// <value> + /// The incoming message filter. + /// </value> + internal Action<IProtocolMessage> IncomingMessageFilter { get; set; } + + /// <summary> /// Gets the binding elements used by this channel, in no particular guaranteed order. /// </summary> protected internal ReadOnlyCollection<IChannelBindingElement> BindingElements { @@ -327,8 +343,8 @@ namespace DotNetOpenAuth.Messaging { /// Gets the protocol message embedded in the given HTTP request, if present. /// </summary> /// <typeparam name="TRequest">The expected type of the message to be received.</typeparam> - /// <param name="cancellationToken">The cancellation token.</param> /// <param name="httpRequest">The request to search for an embedded message.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// True if the expected message was recognized and deserialized. False otherwise. /// </returns> @@ -352,8 +368,8 @@ namespace DotNetOpenAuth.Messaging { /// Gets the protocol message embedded in the given HTTP request. /// </summary> /// <typeparam name="TRequest">The expected type of the message to be received.</typeparam> - /// <param name="cancellationToken">The cancellation token.</param> /// <param name="httpRequest">The request to search for an embedded message.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The deserialized message. Never null. /// </returns> @@ -503,7 +519,10 @@ namespace DotNetOpenAuth.Messaging { /// Gets the protocol message that may be in the given HTTP response. /// </summary> /// <param name="response">The response that is anticipated to contain an protocol message.</param> - /// <returns>The deserialized message parts, if found. Null otherwise.</returns> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns> + /// The deserialized message parts, if found. Null otherwise. + /// </returns> /// <exception cref="ProtocolException">Thrown when the response is not valid.</exception> internal Task<IDictionary<string, string>> ReadFromResponseCoreAsyncTestHook(HttpResponseMessage response, CancellationToken cancellationToken) { return this.ReadFromResponseCoreAsync(response, cancellationToken); @@ -975,10 +994,6 @@ namespace DotNetOpenAuth.Messaging { return dictionary; } - internal Action<IProtocolMessage> OutgoingMessageFilter { get; set; } - - internal Action<IProtocolMessage> IncomingMessageFilter { get; set; } - /// <summary> /// Prepares a message for transmit by applying signatures, nonces, etc. /// </summary> diff --git a/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs b/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs index 924a3c2..ba1faab 100644 --- a/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs +++ b/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs @@ -267,7 +267,7 @@ namespace DotNetOpenAuth.Messaging { /// When overridden in a derived class, gets or sets the MIME content type of the request. /// </summary> /// <returns>The MIME content type of the request, such as "text/html".</returns> - /// <exception cref="System.NotImplementedException"></exception> + /// <exception cref="System.NotImplementedException">Setter always throws</exception> public override string ContentType { get { return this.Headers["Content-Type"]; } set { throw new NotImplementedException(); } diff --git a/src/DotNetOpenAuth.Core/Messaging/HttpResponseMessageWithOriginal.cs b/src/DotNetOpenAuth.Core/Messaging/HttpResponseMessageWithOriginal.cs index 4db9f63..c6d2cc3 100644 --- a/src/DotNetOpenAuth.Core/Messaging/HttpResponseMessageWithOriginal.cs +++ b/src/DotNetOpenAuth.Core/Messaging/HttpResponseMessageWithOriginal.cs @@ -10,6 +10,12 @@ namespace DotNetOpenAuth.Messaging { using Validation; + /// <summary> + /// An HttpResponseMessage that includes the original DNOA semantic message as a property. + /// </summary> + /// <remarks> + /// This is used to assist in testing. + /// </remarks> internal class HttpResponseMessageWithOriginal : HttpResponseMessage { /// <summary> /// Initializes a new instance of the <see cref="HttpResponseMessageWithOriginal"/> class. @@ -18,7 +24,7 @@ namespace DotNetOpenAuth.Messaging { /// <param name="statusCode">The status code.</param> internal HttpResponseMessageWithOriginal(IMessage originalMessage, HttpStatusCode statusCode = HttpStatusCode.OK) : base(statusCode) { - OriginalMessage = originalMessage; + this.OriginalMessage = originalMessage; Requires.NotNull(originalMessage, "originalMessage"); } diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/AccessTokenResponse.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/AccessTokenResponse.cs index dd35400..69160c0 100644 --- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/AccessTokenResponse.cs +++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/AccessTokenResponse.cs @@ -6,14 +6,32 @@ using System.Text; using System.Threading.Tasks; + /// <summary> + /// Captures the data that is returned from a request for an access token. + /// </summary> public class AccessTokenResponse { + /// <summary> + /// Initializes a new instance of the <see cref="AccessTokenResponse"/> class. + /// </summary> + /// <param name="accessToken">The access token.</param> + /// <param name="tokenSecret">The token secret.</param> + /// <param name="extraData">Any extra data that came with the response.</param> public AccessTokenResponse(string accessToken, string tokenSecret, NameValueCollection extraData) { this.AccessToken = new AccessToken(accessToken, tokenSecret); this.ExtraData = extraData; } + /// <summary> + /// Gets or sets the access token. + /// </summary> + /// <value> + /// The access token. + /// </value> public AccessToken AccessToken { get; set; } + /// <summary> + /// Gets or sets any extra data that came with the response.. + /// </summary> public NameValueCollection ExtraData { get; set; } } } diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/Consumer.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/Consumer.cs index 93fbaac..9f79aef 100644 --- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/Consumer.cs +++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/Consumer.cs @@ -23,7 +23,7 @@ namespace DotNetOpenAuth.OAuth { using Validation; /// <summary> - /// Base class for <see cref="WebConsumer"/> and <see cref="DesktopConsumer"/> types. + /// Provides OAuth 1.0 consumer services to a client or web application. /// </summary> public class Consumer { /// <summary> @@ -74,7 +74,7 @@ namespace DotNetOpenAuth.OAuth { } /// <summary> - /// Gets the Consumer Key used to communicate with the Service Provider. + /// Gets or sets the Consumer Key used to communicate with the Service Provider. /// </summary> public string ConsumerKey { get; set; } @@ -103,7 +103,7 @@ namespace DotNetOpenAuth.OAuth { public ServiceProviderDescription ServiceProvider { get; set; } /// <summary> - /// Gets the persistence store for tokens and secrets. + /// Gets or sets the persistence store for tokens and secrets. /// </summary> public ITemporaryCredentialStorage TemporaryCredentialStorage { get; set; } diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/CookieTemporaryCredentialStorage.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/CookieTemporaryCredentialStorage.cs index 25941e6..dac2139 100644 --- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/CookieTemporaryCredentialStorage.cs +++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/CookieTemporaryCredentialStorage.cs @@ -31,7 +31,7 @@ namespace DotNetOpenAuth.OAuth { private readonly HttpContextBase httpContext; /// <summary> - /// Initializes a new instance of the <see cref="CookieTemporaryCredentialsStorage"/> class + /// Initializes a new instance of the <see cref="CookieTemporaryCredentialStorage"/> class /// using <see cref="HttpContext.Current"/> as the source for the context to read and write cookies to. /// </summary> public CookieTemporaryCredentialStorage() @@ -39,7 +39,7 @@ namespace DotNetOpenAuth.OAuth { } /// <summary> - /// Initializes a new instance of the <see cref="CookieTemporaryCredentialsStorage"/> class. + /// Initializes a new instance of the <see cref="CookieTemporaryCredentialStorage"/> class. /// </summary> /// <param name="httpContext">The HTTP context from and to which to access cookies.</param> public CookieTemporaryCredentialStorage(HttpContextBase httpContext) { @@ -75,7 +75,6 @@ namespace DotNetOpenAuth.OAuth { /// <returns> /// An initialized key value pair if credentials are available; otherwise both key and value are <c>null</c>. /// </returns> - /// <exception cref="System.NotImplementedException"></exception> public KeyValuePair<string, string> RetrieveTemporaryCredential() { HttpCookie cookie = this.httpContext.Request.Cookies[TokenCookieKey]; if (cookie == null || cookie.Values.Count == 0) { diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs index 832084d..125505a 100644 --- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs +++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/MemoryTemporaryCredentialStorage.cs @@ -51,7 +51,6 @@ namespace DotNetOpenAuth.OAuth { /// <summary> /// Clears the temporary credentials from storage. /// </summary> - /// <param name="identifier">The identifier of the credentials to clear.</param> /// <remarks> /// DotNetOpenAuth calls this when the credentials are no longer needed. /// </remarks> diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs index aa462f3..0fb8414 100644 --- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs +++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="OAuth1HttpMessageHandler.cs" company="Andrew Arnott"> +// <copyright file="OAuth1HttpMessageHandlerBase.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ServiceProviderDescription.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ServiceProviderDescription.cs index 2d07af4..b04b35b 100644 --- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ServiceProviderDescription.cs +++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ServiceProviderDescription.cs @@ -61,7 +61,7 @@ namespace DotNetOpenAuth.OAuth { public HttpMethod TemporaryCredentialsRequestEndpointMethod { get; set; } /// <summary> - /// Gets the resource owner authorization endpoint. + /// Gets or sets the resource owner authorization endpoint. /// </summary> /// <value> /// The resource owner authorization endpoint. @@ -70,7 +70,7 @@ namespace DotNetOpenAuth.OAuth { public Uri ResourceOwnerAuthorizationEndpoint { get; set; } /// <summary> - /// Gets the token request endpoint. + /// Gets or sets the token request endpoint. /// </summary> /// <value> /// The token request endpoint. diff --git a/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj b/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj index af9aea9..b348018 100644 --- a/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj +++ b/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj @@ -34,7 +34,6 @@ <Compile Include="OAuth\ChannelElements\UriOrOobEncoding.cs" /> <Compile Include="OAuth\ConsumerSecuritySettings.cs" /> <Compile Include="OAuth\Messages\ITokenSecretContainingMessage.cs" /> - <Compile Include="OAuth\Messages\MessageBaseSimple.cs" /> <Compile Include="OAuth\OAuthStrings.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs index f483ade..d606ff0 100644 --- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs +++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs @@ -168,6 +168,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { /// Gets the protocol message that may be in the given HTTP response. /// </summary> /// <param name="response">The response that is anticipated to contain an protocol message.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The deserialized message parts, if found. Null otherwise. /// </returns> diff --git a/src/DotNetOpenAuth.OAuth/OAuth/Messages/MessageBaseSimple.cs b/src/DotNetOpenAuth.OAuth/OAuth/Messages/MessageBaseSimple.cs deleted file mode 100644 index 23822d3..0000000 --- a/src/DotNetOpenAuth.OAuth/OAuth/Messages/MessageBaseSimple.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DotNetOpenAuth.OAuth.Messages { - class MessageBaseSimple { - } -} diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs index e7edb66..ba542a4 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs @@ -142,7 +142,10 @@ namespace DotNetOpenAuth.OAuth2 { /// Handles an incoming request to the authorization server's token endpoint. /// </summary> /// <param name="request">The HTTP request.</param> - /// <returns>The HTTP response to send to the client.</returns> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns> + /// The HTTP response to send to the client. + /// </returns> public async Task<HttpResponseMessage> HandleTokenRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken = default(CancellationToken)) { Requires.NotNull(request, "request"); diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs index 609cedb..848b10e 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs @@ -62,9 +62,11 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// Gets the protocol message that may be in the given HTTP response. /// </summary> /// <param name="response">The response that is anticipated to contain an protocol message.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The deserialized message parts, if found. Null otherwise. /// </returns> + /// <exception cref="System.NotImplementedException">Always thrown.</exception> /// <exception cref="ProtocolException">Thrown when the response is not valid.</exception> protected override Task<IDictionary<string, string>> ReadFromResponseCoreAsync(HttpResponseMessage response, CancellationToken cancellationToken) { throw new NotImplementedException(); diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ClientDescription.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ClientDescription.cs index 6d77f14..ce83dc6 100644 --- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ClientDescription.cs +++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ClientDescription.cs @@ -57,7 +57,7 @@ namespace DotNetOpenAuth.OAuth2 { #region IClientDescription Members /// <summary> - /// Gets the callback to use when an individual authorization request + /// Gets or sets the callback to use when an individual authorization request /// does not include an explicit callback URI. /// </summary> /// <value> @@ -66,7 +66,7 @@ namespace DotNetOpenAuth.OAuth2 { public Uri DefaultCallback { get; protected set; } /// <summary> - /// Gets the type of the client. + /// Gets or sets the type of the client. /// </summary> public ClientType ClientType { get; protected set; } diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs index aba0290..f4e959d 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs @@ -89,6 +89,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// Gets the protocol message that may be in the given HTTP response. /// </summary> /// <param name="response">The response that is anticipated to contain an protocol message.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The deserialized message parts, if found. Null otherwise. /// </returns> diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs index 9730321..e05dfce 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs @@ -26,14 +26,13 @@ namespace DotNetOpenAuth.OAuth2 { /// </summary> public class ClientBase { /// <summary> - /// Initializes a new instance of the <see cref="ClientBase"/> class. + /// Initializes a new instance of the <see cref="ClientBase" /> class. /// </summary> /// <param name="authorizationServer">The token issuer.</param> /// <param name="clientIdentifier">The client identifier.</param> - /// <param name="clientCredentialApplicator"> - /// The tool to use to apply client credentials to authenticated requests to the Authorization Server. - /// May be <c>null</c> for clients with no secret or other means of authentication. - /// </param> + /// <param name="clientCredentialApplicator">The tool to use to apply client credentials to authenticated requests to the Authorization Server. + /// May be <c>null</c> for clients with no secret or other means of authentication.</param> + /// <param name="hostFactories">The host factories.</param> protected ClientBase(AuthorizationServerDescription authorizationServer, string clientIdentifier = null, ClientCredentialApplicator clientCredentialApplicator = null, IHostFactories hostFactories = null) { Requires.NotNull(authorizationServer, "authorizationServer"); this.AuthorizationServer = authorizationServer; diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs index 7a52c0f..0ae85b4 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs @@ -23,36 +23,37 @@ namespace DotNetOpenAuth.OAuth2 { /// </summary> public class UserAgentClient : ClientBase { /// <summary> - /// Initializes a new instance of the <see cref="UserAgentClient"/> class. + /// Initializes a new instance of the <see cref="UserAgentClient" /> class. /// </summary> /// <param name="authorizationServer">The token issuer.</param> /// <param name="clientIdentifier">The client identifier.</param> /// <param name="clientSecret">The client secret.</param> + /// <param name="hostFactories">The host factories.</param> public UserAgentClient(AuthorizationServerDescription authorizationServer, string clientIdentifier = null, string clientSecret = null, IHostFactories hostFactories = null) : this(authorizationServer, clientIdentifier, DefaultSecretApplicator(clientSecret), hostFactories) { } /// <summary> - /// Initializes a new instance of the <see cref="UserAgentClient"/> class. + /// Initializes a new instance of the <see cref="UserAgentClient" /> class. /// </summary> /// <param name="authorizationEndpoint">The authorization endpoint.</param> /// <param name="tokenEndpoint">The token endpoint.</param> /// <param name="clientIdentifier">The client identifier.</param> /// <param name="clientSecret">The client secret.</param> + /// <param name="hostFactories">The host factories.</param> public UserAgentClient(Uri authorizationEndpoint, Uri tokenEndpoint, string clientIdentifier = null, string clientSecret = null, IHostFactories hostFactories = null) : this(authorizationEndpoint, tokenEndpoint, clientIdentifier, DefaultSecretApplicator(clientSecret), hostFactories) { } /// <summary> - /// Initializes a new instance of the <see cref="UserAgentClient"/> class. + /// Initializes a new instance of the <see cref="UserAgentClient" /> class. /// </summary> /// <param name="authorizationEndpoint">The authorization endpoint.</param> /// <param name="tokenEndpoint">The token endpoint.</param> /// <param name="clientIdentifier">The client identifier.</param> - /// <param name="clientCredentialApplicator"> - /// The tool to use to apply client credentials to authenticated requests to the Authorization Server. - /// May be <c>null</c> for clients with no secret or other means of authentication. - /// </param> + /// <param name="clientCredentialApplicator">The tool to use to apply client credentials to authenticated requests to the Authorization Server. + /// May be <c>null</c> for clients with no secret or other means of authentication.</param> + /// <param name="hostFactories">The host factories.</param> public UserAgentClient(Uri authorizationEndpoint, Uri tokenEndpoint, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator, IHostFactories hostFactories = null) : this(new AuthorizationServerDescription { AuthorizationEndpoint = authorizationEndpoint, TokenEndpoint = tokenEndpoint }, clientIdentifier, clientCredentialApplicator, hostFactories) { Requires.NotNull(authorizationEndpoint, "authorizationEndpoint"); @@ -60,14 +61,13 @@ namespace DotNetOpenAuth.OAuth2 { } /// <summary> - /// Initializes a new instance of the <see cref="UserAgentClient"/> class. + /// Initializes a new instance of the <see cref="UserAgentClient" /> class. /// </summary> /// <param name="authorizationServer">The token issuer.</param> /// <param name="clientIdentifier">The client identifier.</param> - /// <param name="clientCredentialApplicator"> - /// The tool to use to apply client credentials to authenticated requests to the Authorization Server. - /// May be <c>null</c> for clients with no secret or other means of authentication. - /// </param> + /// <param name="clientCredentialApplicator">The tool to use to apply client credentials to authenticated requests to the Authorization Server. + /// May be <c>null</c> for clients with no secret or other means of authentication.</param> + /// <param name="hostFactories">The host factories.</param> public UserAgentClient(AuthorizationServerDescription authorizationServer, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator, IHostFactories hostFactories = null) : base(authorizationServer, clientIdentifier, clientCredentialApplicator, hostFactories) { } diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs index 2b5a80a..795047f 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs @@ -49,7 +49,7 @@ namespace DotNetOpenAuth.OAuth2 { /// <param name="clientIdentifier">The client identifier.</param> /// <param name="clientCredentialApplicator">The tool to use to apply client credentials to authenticated requests to the Authorization Server. /// May be <c>null</c> for clients with no secret or other means of authentication.</param> - /// <param name="hostFactories"></param> + /// <param name="hostFactories">The host factories.</param> public WebServerClient(AuthorizationServerDescription authorizationServer, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator, IHostFactories hostFactories = null) : base(authorizationServer, clientIdentifier, clientCredentialApplicator, hostFactories) { } diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs index 1d90844..6e8f216 100644 --- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs +++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs @@ -86,9 +86,11 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// Gets the protocol message that may be in the given HTTP response. /// </summary> /// <param name="response">The response that is anticipated to contain an protocol message.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The deserialized message parts, if found. Null otherwise. /// </returns> + /// <exception cref="System.NotImplementedException">Always thrown.</exception> /// <exception cref="ProtocolException">Thrown when the response is not valid.</exception> protected override Task<IDictionary<string, string>> ReadFromResponseCoreAsync(HttpResponseMessage response, CancellationToken cancellationToken) { // We never expect resource servers to send out direct requests, @@ -130,7 +132,10 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { /// Searches for a bearer access token in the request. /// </summary> /// <param name="request">The request.</param> - /// <returns>The bearer access token, if one exists. Otherwise <c>null</c>.</returns> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns> + /// The bearer access token, if one exists. Otherwise <c>null</c>. + /// </returns> private static async Task<string> SearchForBearerAccessTokenInRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) { Requires.NotNull(request, "request"); diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs index e990e0b..6005b75 100644 --- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs +++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs @@ -99,7 +99,7 @@ namespace DotNetOpenAuth.OAuth2 { /// <summary> /// Discovers what access the client should have considering the access token in the current request. /// </summary> - /// <param name="request">The HTTP request message.</param> + /// <param name="requestMessage">The request message.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <param name="requiredScopes">The set of scopes required to approve this request.</param> /// <returns> diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs index 3bd0324..6137cff 100644 --- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs +++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs @@ -31,8 +31,9 @@ namespace DotNetOpenAuth.OAuth2 { } /// <summary> - /// Initializes a new instance of the <see cref="StandardAccessTokenAnalyzer"/> class. + /// Initializes a new instance of the <see cref="StandardAccessTokenAnalyzer" /> class. /// </summary> + /// <param name="symmetricKeyStore">The symmetric key store.</param> public StandardAccessTokenAnalyzer(ICryptoKeyStore symmetricKeyStore) { Requires.NotNull(symmetricKeyStore, "symmetricKeyStore"); this.SymmetricKeyStore = symmetricKeyStore; @@ -50,6 +51,12 @@ namespace DotNetOpenAuth.OAuth2 { /// <value>The resource server private encryption key.</value> public RSACryptoServiceProvider ResourceServerPrivateEncryptionKey { get; private set; } + /// <summary> + /// Gets the symmetric key store. + /// </summary> + /// <value> + /// The symmetric key store. + /// </value> public ICryptoKeyStore SymmetricKeyStore { get; private set; } /// <summary> diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs index a8c911e..ab1cae6 100644 --- a/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs @@ -59,7 +59,10 @@ namespace DotNetOpenAuth.OAuth2 { /// <summary> /// Creates a formatter capable of serializing/deserializing an access token. /// </summary> - /// <returns>An access token serializer.</returns> + /// <param name="symmetricKeyStore">The symmetric key store.</param> + /// <returns> + /// An access token serializer. + /// </returns> internal static IDataBagFormatter<AccessToken> CreateFormatter(ICryptoKeyStore symmetricKeyStore) { Requires.NotNull(symmetricKeyStore, "symmetricKeyStore"); return new UriStyleMessageFormatter<AccessToken>(symmetricKeyStore, bucket: "AccessTokens", signed: true, encrypted: true); diff --git a/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs b/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs index 603d530..a450262 100644 --- a/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs +++ b/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs @@ -69,21 +69,6 @@ namespace DotNetOpenAuth.OpenId.Provider { public event EventHandler<AnonymousRequestEventArgs> AnonymousRequest; /// <summary> - /// Gets or sets the <see cref="OpenIdProvider"/> instance to use for all instances of this control. - /// </summary> - /// <value>The default value is an <see cref="OpenIdProvider"/> instance initialized according to the web.config file.</value> - public OpenIdProvider Provider { - get { - return this.provider.Value; - } - - set { - Requires.NotNull(value, "value"); - this.provider = new Lazy<OpenIdProvider>(() => value, LazyThreadSafetyMode.PublicationOnly); - } - } - - /// <summary> /// Gets or sets an incoming OpenID authentication request that has not yet been responded to. /// </summary> /// <remarks> @@ -153,6 +138,21 @@ namespace DotNetOpenAuth.OpenId.Provider { } /// <summary> + /// Gets or sets the <see cref="OpenIdProvider"/> instance to use for all instances of this control. + /// </summary> + /// <value>The default value is an <see cref="OpenIdProvider"/> instance initialized according to the web.config file.</value> + public OpenIdProvider Provider { + get { + return this.provider.Value; + } + + set { + Requires.NotNull(value, "value"); + this.provider = new Lazy<OpenIdProvider>(() => value, LazyThreadSafetyMode.PublicationOnly); + } + } + + /// <summary> /// Gets or sets a value indicating whether or not this control should /// be listening for and responding to incoming OpenID requests. /// </summary> diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs index 5aea3ca..eb7a727 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs @@ -66,7 +66,10 @@ namespace DotNetOpenAuth.OpenId.Provider { /// <summary> /// Gets the response message, once <see cref="IsResponseReady" /> is <c>true</c>. /// </summary> - /// <returns>The response message.</returns> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns> + /// The response message. + /// </returns> internal Task<IProtocolMessage> GetResponseMessageAsyncTestHook(CancellationToken cancellationToken) { return this.GetResponseMessageAsync(cancellationToken); } diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs index a727e42..abadee8 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs @@ -9,13 +9,13 @@ namespace DotNetOpenAuth.OpenId.Provider { using System.Collections.Generic; using System.Linq; using System.Net; + using System.Runtime.Serialization; using System.Text; using System.Threading; using System.Threading.Tasks; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; using Validation; - using System.Runtime.Serialization; /// <summary> /// A base class from which identity and non-identity RP requests can derive. diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs index aabc8cb..256b7a6 100644 --- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs +++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs @@ -204,6 +204,7 @@ namespace DotNetOpenAuth.OpenId.Provider { /// <summary> /// Gets the incoming OpenID request if there is one, or null if none was detected. /// </summary> + /// <param name="request">The request.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The request that the hosting Provider should possibly process and then transmit the response for. @@ -448,7 +449,7 @@ namespace DotNetOpenAuth.OpenId.Provider { /// Prepares the return value for the GetRequest method in the event of an exception. /// </summary> /// <param name="ex">The exception that forms the basis of the error response. Must not be null.</param> - /// <param name="httpRequestInfo">The incoming HTTP request. Must not be null.</param> + /// <param name="request">The incoming HTTP request. Must not be null.</param> /// <param name="incomingMessage">The incoming message. May be null in the case that it was malformed.</param> /// <returns> /// Either the <see cref="IRequest"/> to return to the host site or null to indicate no response could be reasonably created and that the caller should rethrow the exception. diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs index eeca146..67e87f7 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs @@ -515,6 +515,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <summary> /// Gets an authentication response from a Provider. /// </summary> + /// <param name="request">The request.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The processed authentication response if there is any; <c>null</c> otherwise. @@ -530,7 +531,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <summary> /// Gets an authentication response from a Provider. /// </summary> - /// <param name="httpRequestInfo">The HTTP request that may be carrying an authentication response from the Provider.</param> + /// <param name="request">The HTTP request that may be carrying an authentication response from the Provider.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// The processed authentication response if there is any; <c>null</c> otherwise. @@ -608,7 +609,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <typeparam name="T">The extension <i>response</i> type that will read data from the assertion.</typeparam> /// <param name="propertyName">The property name on the openid_identifier input box object that will be used to store the extension data. For example: sreg</param> /// <remarks> - /// This method should be called before <see cref="ProcessResponseFromPopupAsync(CancellationToken)"/>. + /// This method should be called before <see cref="ProcessResponseFromPopupAsync(HttpRequestMessage, CancellationToken)"/>. /// </remarks> [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "By design")] public void RegisterClientScriptExtension<T>(string propertyName) where T : IClientScriptExtensionResponse { diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs index 9c06e6b..aad5477 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs @@ -131,7 +131,10 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { /// Decodes bytes in Key-Value Form to key/value pairs. /// </summary> /// <param name="data">The stream of Key-Value Form encoded bytes.</param> - /// <returns>The deserialized dictionary.</returns> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns> + /// The deserialized dictionary. + /// </returns> /// <exception cref="FormatException">Thrown when the data is not in the expected format.</exception> public async Task<IDictionary<string, string>> GetDictionaryAsync(Stream data, CancellationToken cancellationToken) { using (StreamReader reader = new StreamReader(data, textEncoding)) { diff --git a/src/DotNetOpenAuth.OpenId/OpenId/UntrustedWebRequestHandler.cs b/src/DotNetOpenAuth.OpenId/OpenId/UntrustedWebRequestHandler.cs index 94d92e5..a904813 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/UntrustedWebRequestHandler.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/UntrustedWebRequestHandler.cs @@ -126,13 +126,13 @@ namespace DotNetOpenAuth.OpenId { /// </summary> public int MaxAutomaticRedirections { get { - return base.InnerHandler is WebRequestHandler ? this.InnerWebRequestHandler.MaxAutomaticRedirections : this.maxAutomaticRedirections; + return this.InnerHandler is WebRequestHandler ? this.InnerWebRequestHandler.MaxAutomaticRedirections : this.maxAutomaticRedirections; } set { Requires.Range(value >= 0, "value"); this.maxAutomaticRedirections = value; - if (base.InnerHandler is WebRequestHandler) { + if (this.InnerHandler is WebRequestHandler) { this.InnerWebRequestHandler.MaxAutomaticRedirections = value; } } @@ -143,12 +143,12 @@ namespace DotNetOpenAuth.OpenId { /// </summary> public bool AllowAutoRedirect { get { - return base.InnerHandler is WebRequestHandler ? this.InnerWebRequestHandler.AllowAutoRedirect : this.allowAutoRedirect; + return this.InnerHandler is WebRequestHandler ? this.InnerWebRequestHandler.AllowAutoRedirect : this.allowAutoRedirect; } set { this.allowAutoRedirect = value; - if (base.InnerHandler is WebRequestHandler) { + if (this.InnerHandler is WebRequestHandler) { this.InnerWebRequestHandler.AllowAutoRedirect = value; } } diff --git a/src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs b/src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs index 77d4926..ac9c44d 100644 --- a/src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs +++ b/src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs @@ -170,8 +170,8 @@ namespace DotNetOpenAuth.Yadis { HttpResponseMessage response = null; try { - response = await httpClient.SendAsync(request, cancellationToken); // http://stackoverflow.com/questions/14103154/how-to-determine-if-an-httpresponsemessage-was-fulfilled-from-cache-using-httpcl + response = await httpClient.SendAsync(request, cancellationToken); if (!response.IsSuccessStatusCode && response.Headers.Age.HasValue && response.Headers.Age.Value > TimeSpan.Zero) { // We don't want to report error responses from the cache, since the server may have fixed // whatever was causing the problem. So try again with cache disabled. diff --git a/src/DotNetOpenAuth.OpenIdOAuth/OAuth/WebConsumerOpenIdRelyingParty.cs b/src/DotNetOpenAuth.OpenIdOAuth/OAuth/WebConsumerOpenIdRelyingParty.cs index dce51c2..708c1cd 100644 --- a/src/DotNetOpenAuth.OpenIdOAuth/OAuth/WebConsumerOpenIdRelyingParty.cs +++ b/src/DotNetOpenAuth.OpenIdOAuth/OAuth/WebConsumerOpenIdRelyingParty.cs @@ -32,8 +32,6 @@ namespace DotNetOpenAuth.OAuth { /// <summary> /// Initializes a new instance of the <see cref="WebConsumerOpenIdRelyingParty"/> class. /// </summary> - /// <param name="serviceDescription">The endpoints and behavior of the Service Provider.</param> - /// <param name="tokenManager">The host's method of storing and recalling tokens and secrets.</param> public WebConsumerOpenIdRelyingParty() { } @@ -61,10 +59,6 @@ namespace DotNetOpenAuth.OAuth { /// <returns> /// The access token, or null if OAuth authorization was denied by the user or service provider. /// </returns> - /// <remarks> - /// The access token, if granted, is automatically stored in the <see cref="ConsumerBase.TokenManager" />. - /// The token manager instance must implement <see cref="IOpenIdOAuthTokenManager" />. - /// </remarks> public async Task<AccessTokenResponse> ProcessUserAuthorizationAsync(IAuthenticationResponse openIdAuthenticationResponse, CancellationToken cancellationToken = default(CancellationToken)) { Requires.NotNull(openIdAuthenticationResponse, "openIdAuthenticationResponse"); diff --git a/src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs b/src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs index 7903e89..f97e795 100644 --- a/src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs +++ b/src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs @@ -73,37 +73,6 @@ namespace DotNetOpenAuth.Test { return result; } - internal Channel CreateChannel(MessageProtections capabilityAndRecognition) { - return this.CreateChannel(capabilityAndRecognition, capabilityAndRecognition); - } - - internal Channel CreateChannel(MessageProtections capability, MessageProtections recognition) { - var bindingElements = new List<IChannelBindingElement>(); - if (capability >= MessageProtections.TamperProtection) { - bindingElements.Add(new MockSigningBindingElement()); - } - if (capability >= MessageProtections.Expiration) { - bindingElements.Add(new StandardExpirationBindingElement()); - } - if (capability >= MessageProtections.ReplayProtection) { - bindingElements.Add(new MockReplayProtectionBindingElement()); - } - - bool signing = false, expiration = false, replay = false; - if (recognition >= MessageProtections.TamperProtection) { - signing = true; - } - if (recognition >= MessageProtections.Expiration) { - expiration = true; - } - if (recognition >= MessageProtections.ReplayProtection) { - replay = true; - } - - var typeProvider = new TestMessageFactory(signing, expiration, replay); - return new TestChannel(typeProvider, bindingElements.ToArray(), this.HostFactories); - } - internal static IDictionary<string, string> GetStandardTestFields(FieldFill fill) { TestMessage expectedMessage = GetStandardTestMessage(fill); @@ -145,6 +114,37 @@ namespace DotNetOpenAuth.Test { } } + internal Channel CreateChannel(MessageProtections capabilityAndRecognition) { + return this.CreateChannel(capabilityAndRecognition, capabilityAndRecognition); + } + + internal Channel CreateChannel(MessageProtections capability, MessageProtections recognition) { + var bindingElements = new List<IChannelBindingElement>(); + if (capability >= MessageProtections.TamperProtection) { + bindingElements.Add(new MockSigningBindingElement()); + } + if (capability >= MessageProtections.Expiration) { + bindingElements.Add(new StandardExpirationBindingElement()); + } + if (capability >= MessageProtections.ReplayProtection) { + bindingElements.Add(new MockReplayProtectionBindingElement()); + } + + bool signing = false, expiration = false, replay = false; + if (recognition >= MessageProtections.TamperProtection) { + signing = true; + } + if (recognition >= MessageProtections.Expiration) { + expiration = true; + } + if (recognition >= MessageProtections.ReplayProtection) { + replay = true; + } + + var typeProvider = new TestMessageFactory(signing, expiration, replay); + return new TestChannel(typeProvider, bindingElements.ToArray(), this.HostFactories); + } + internal async Task ParameterizedReceiveTestAsync(HttpMethod method) { var fields = GetStandardTestFields(FieldFill.CompleteBeforeBindings); TestMessage expectedMessage = GetStandardTestMessage(FieldFill.CompleteBeforeBindings); diff --git a/src/DotNetOpenAuth.Test/MockingHostFactories.cs b/src/DotNetOpenAuth.Test/MockingHostFactories.cs index b8cbeb0..93579ad 100644 --- a/src/DotNetOpenAuth.Test/MockingHostFactories.cs +++ b/src/DotNetOpenAuth.Test/MockingHostFactories.cs @@ -5,17 +5,15 @@ //----------------------------------------------------------------------- namespace DotNetOpenAuth.Test { + using System; using System.Collections.Generic; + using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; - using System.Linq; - using DotNetOpenAuth.OpenId; - using Validation; - using System; internal class MockingHostFactories : IHostFactories { public MockingHostFactories(Dictionary<Uri, Func<HttpRequestMessage, Task<HttpResponseMessage>>> handlers = null) { diff --git a/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs b/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs index 433cbf3..f395e38 100644 --- a/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs +++ b/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs @@ -118,9 +118,9 @@ namespace DotNetOpenAuth.Test.OAuth2 { authServer.Setup( a => a.CheckAuthorizeClientCredentialsGrant(It.Is<IAccessTokenRequest>(d => d.ClientIdentifier == ClientId && MessagingUtilities.AreEquivalent(d.Scope, TestScopes)))) .Returns<IAccessTokenRequest>(req => { - var response = new AutomatedAuthorizationCheckResponse(req, true); - response.ApprovedScope.ResetContents(approvedScopes); - return response; + var response = new AutomatedAuthorizationCheckResponse(req, true); + response.ApprovedScope.ResetContents(approvedScopes); + return response; }); Handle(AuthorizationServerDescription.TokenEndpoint).By( async (req, ct) => { diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs index 1a1307d..ca0e4b4 100644 --- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs @@ -124,7 +124,6 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { var opStore = new StandardProviderApplicationStore(); int rpStep = 0; - Handle(RPUri).By( async req => { var rp = new OpenIdRelyingParty(new StandardRelyingPartyApplicationStore(), this.HostFactories); @@ -157,7 +156,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { { var op = new OpenIdProvider(opStore, this.HostFactories); RegisterMockExtension(op.Channel); - var redirectingResponse = await op.Channel.PrepareResponseAsync(CreateResponseWithExtensions(protocol)); + var redirectingResponse = await op.Channel.PrepareResponseAsync(this.CreateResponseWithExtensions(protocol)); using (var httpClient = this.HostFactories.CreateHttpClient()) { using (var response = await httpClient.GetAsync(redirectingResponse.Headers.Location)) { response.EnsureSuccessStatusCode(); @@ -165,7 +164,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { } op.SecuritySettings.SignOutgoingExtensions = false; - redirectingResponse = await op.Channel.PrepareResponseAsync(CreateResponseWithExtensions(protocol)); + redirectingResponse = await op.Channel.PrepareResponseAsync(this.CreateResponseWithExtensions(protocol)); using (var httpClient = this.HostFactories.CreateHttpClient()) { using (var response = await httpClient.GetAsync(redirectingResponse.Headers.Location)) { response.EnsureSuccessStatusCode(); diff --git a/src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs b/src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs index 11463c7..2e2a960 100644 --- a/src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs @@ -6,17 +6,16 @@ namespace DotNetOpenAuth.Test.OpenId { using System; + using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; - using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.Messages; using DotNetOpenAuth.OpenId.Provider; using DotNetOpenAuth.OpenId.RelyingParty; using NUnit.Framework; - using System.Net; [TestFixture] public class NonIdentityTests : OpenIdTestBase { diff --git a/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs b/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs index ea2867c..9872b01 100644 --- a/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs +++ b/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs @@ -196,72 +196,6 @@ namespace DotNetOpenAuth.Test.OpenId { var rp = this.CreateRelyingParty(true); return rp.DiscoverAsync(identifier, cancellationToken); } - - protected Realm GetMockRealm(bool useSsl) { - var rpDescription = new RelyingPartyEndpointDescription(useSsl ? RPUriSsl : RPUri, new string[] { Protocol.V20.RPReturnToTypeURI }); - return new MockRealm(useSsl ? RPRealmUriSsl : RPRealmUri, rpDescription); - } - - protected Identifier GetMockIdentifier(ProtocolVersion providerVersion) { - return this.GetMockIdentifier(providerVersion, false); - } - - protected Identifier GetMockIdentifier(ProtocolVersion providerVersion, bool useSsl) { - return this.GetMockIdentifier(providerVersion, useSsl, false); - } - - protected Identifier GetMockIdentifier(ProtocolVersion providerVersion, bool useSsl, bool delegating) { - var se = GetServiceEndpoint(0, providerVersion, 10, useSsl, delegating); - this.RegisterMockXrdsResponse(se); - return se.ClaimedIdentifier; - } - - protected Identifier GetMockDualIdentifier() { - Protocol protocol = Protocol.Default; - var opDesc = new ProviderEndpointDescription(OPUri, protocol.Version); - var dualResults = new IdentifierDiscoveryResult[] { - IdentifierDiscoveryResult.CreateForClaimedIdentifier(VanityUri.AbsoluteUri, OPLocalIdentifiers[0], opDesc, 10, 10), - IdentifierDiscoveryResult.CreateForProviderIdentifier(protocol.ClaimedIdentifierForOPIdentifier, opDesc, 20, 20), - }; - - this.RegisterMockXrdsResponse(VanityUri, dualResults); - return VanityUri; - } - - /// <summary> - /// Creates a standard <see cref="OpenIdRelyingParty"/> instance for general testing. - /// </summary> - /// <returns>The new instance.</returns> - protected OpenIdRelyingParty CreateRelyingParty() { - return this.CreateRelyingParty(false); - } - - /// <summary> - /// Creates a standard <see cref="OpenIdRelyingParty"/> instance for general testing. - /// </summary> - /// <param name="stateless">if set to <c>true</c> a stateless RP is created.</param> - /// <returns>The new instance.</returns> - protected OpenIdRelyingParty CreateRelyingParty(bool stateless) { - var rp = new OpenIdRelyingParty(stateless ? null : new StandardRelyingPartyApplicationStore(), this.HostFactories); - return rp; - } - - /// <summary> - /// Creates a standard <see cref="OpenIdProvider"/> instance for general testing. - /// </summary> - /// <returns>The new instance.</returns> - protected OpenIdProvider CreateProvider() { - var op = new OpenIdProvider(new StandardProviderApplicationStore(), this.HostFactories); - return op; - } - - protected internal void HandleProvider(Func<OpenIdProvider, HttpRequestMessage, Task<HttpResponseMessage>> provider) { - var op = this.CreateProvider(); - this.Handle(OPUri).By(async req => { - return await provider(op, req); - }); - } - /// <summary> /// Simulates an extension request and response. /// </summary> @@ -335,5 +269,71 @@ namespace DotNetOpenAuth.Test.OpenId { CollectionAssert<IOpenIdMessageExtension>.AreEquivalentByEquality(responses.ToArray(), receivedResponses.ToArray()); } } + + protected internal void HandleProvider(Func<OpenIdProvider, HttpRequestMessage, Task<HttpResponseMessage>> provider) { + var op = this.CreateProvider(); + this.Handle(OPUri).By(async req => { + return await provider(op, req); + }); + } + + protected Realm GetMockRealm(bool useSsl) { + var rpDescription = new RelyingPartyEndpointDescription(useSsl ? RPUriSsl : RPUri, new string[] { Protocol.V20.RPReturnToTypeURI }); + return new MockRealm(useSsl ? RPRealmUriSsl : RPRealmUri, rpDescription); + } + + protected Identifier GetMockIdentifier(ProtocolVersion providerVersion) { + return this.GetMockIdentifier(providerVersion, false); + } + + protected Identifier GetMockIdentifier(ProtocolVersion providerVersion, bool useSsl) { + return this.GetMockIdentifier(providerVersion, useSsl, false); + } + + protected Identifier GetMockIdentifier(ProtocolVersion providerVersion, bool useSsl, bool delegating) { + var se = GetServiceEndpoint(0, providerVersion, 10, useSsl, delegating); + this.RegisterMockXrdsResponse(se); + return se.ClaimedIdentifier; + } + + protected Identifier GetMockDualIdentifier() { + Protocol protocol = Protocol.Default; + var opDesc = new ProviderEndpointDescription(OPUri, protocol.Version); + var dualResults = new IdentifierDiscoveryResult[] { + IdentifierDiscoveryResult.CreateForClaimedIdentifier(VanityUri.AbsoluteUri, OPLocalIdentifiers[0], opDesc, 10, 10), + IdentifierDiscoveryResult.CreateForProviderIdentifier(protocol.ClaimedIdentifierForOPIdentifier, opDesc, 20, 20), + }; + + this.RegisterMockXrdsResponse(VanityUri, dualResults); + return VanityUri; + } + + /// <summary> + /// Creates a standard <see cref="OpenIdRelyingParty"/> instance for general testing. + /// </summary> + /// <returns>The new instance.</returns> + protected OpenIdRelyingParty CreateRelyingParty() { + return this.CreateRelyingParty(false); + } + + /// <summary> + /// Creates a standard <see cref="OpenIdRelyingParty"/> instance for general testing. + /// </summary> + /// <param name="stateless">if set to <c>true</c> a stateless RP is created.</param> + /// <returns>The new instance.</returns> + protected OpenIdRelyingParty CreateRelyingParty(bool stateless) { + var rp = new OpenIdRelyingParty(stateless ? null : new StandardRelyingPartyApplicationStore(), this.HostFactories); + return rp; + } + + /// <summary> + /// Creates a standard <see cref="OpenIdProvider"/> instance for general testing. + /// </summary> + /// <returns>The new instance.</returns> + protected OpenIdProvider CreateProvider() { + var op = new OpenIdProvider(new StandardProviderApplicationStore(), this.HostFactories); + return op; + } + } } diff --git a/src/DotNetOpenAuth.Test/Settings.StyleCop b/src/DotNetOpenAuth.Test/Settings.StyleCop index 2e6f7e3..621fc43 100644 --- a/src/DotNetOpenAuth.Test/Settings.StyleCop +++ b/src/DotNetOpenAuth.Test/Settings.StyleCop @@ -1,4 +1,4 @@ -<StyleCopSettings Version="4.3"> +<StyleCopSettings Version="105"> <Analyzers> <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules"> <Rules> @@ -12,6 +12,21 @@ <BooleanProperty Name="Enabled">False</BooleanProperty> </RuleSettings> </Rule> + <Rule Name="ElementReturnValueMustBeDocumented"> + <RuleSettings> + <BooleanProperty Name="Enabled">False</BooleanProperty> + </RuleSettings> + </Rule> + <Rule Name="ElementParametersMustBeDocumented"> + <RuleSettings> + <BooleanProperty Name="Enabled">False</BooleanProperty> + </RuleSettings> + </Rule> + <Rule Name="ElementParameterDocumentationMustMatchElementParameters"> + <RuleSettings> + <BooleanProperty Name="Enabled">False</BooleanProperty> + </RuleSettings> + </Rule> </Rules> <AnalyzerSettings /> </Analyzer> @@ -22,6 +37,11 @@ <BooleanProperty Name="Enabled">False</BooleanProperty> </RuleSettings> </Rule> + <Rule Name="OpeningCurlyBracketsMustNotBePrecededByBlankLine"> + <RuleSettings> + <BooleanProperty Name="Enabled">False</BooleanProperty> + </RuleSettings> + </Rule> </Rules> <AnalyzerSettings /> </Analyzer> diff --git a/src/DotNetOpenAuth.Test/TestBase.cs b/src/DotNetOpenAuth.Test/TestBase.cs index 4758b7d..470fcf6 100644 --- a/src/DotNetOpenAuth.Test/TestBase.cs +++ b/src/DotNetOpenAuth.Test/TestBase.cs @@ -19,9 +19,8 @@ namespace DotNetOpenAuth.Test { using DotNetOpenAuth.OpenId.RelyingParty; using DotNetOpenAuth.Test.Performance; using log4net; - using NUnit.Framework; - using log4net.Config; + using NUnit.Framework; /// <summary> /// The base class that all test classes inherit from. @@ -55,7 +54,7 @@ namespace DotNetOpenAuth.Test { get { return this.messageDescriptions; } } - internal MockingHostFactories HostFactories; + internal MockingHostFactories HostFactories { get; set; } /// <summary> /// The TestInitialize method for the test cases. |