diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-04-30 23:40:46 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-04-30 23:40:46 -0700 |
commit | 5c937f16690ad0ac6cefd0d84f64461b68b79921 (patch) | |
tree | a62a3b59dcb5671d402452ef856e2a0974b5d012 | |
parent | dbac83dde08e43c82d256e90ce36862dc1168199 (diff) | |
download | DotNetOpenAuth-5c937f16690ad0ac6cefd0d84f64461b68b79921.zip DotNetOpenAuth-5c937f16690ad0ac6cefd0d84f64461b68b79921.tar.gz DotNetOpenAuth-5c937f16690ad0ac6cefd0d84f64461b68b79921.tar.bz2 |
StyleCop fixes.
10 files changed, 50 insertions, 47 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs index 8244e3d..55018e4 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs +++ b/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs @@ -86,7 +86,7 @@ namespace DotNetOpenAuth.ApplicationBlock { Finance = 0x8, /// <summary> - /// Gmail + /// Google Gmail /// </summary> Gmail = 0x10, @@ -96,7 +96,7 @@ namespace DotNetOpenAuth.ApplicationBlock { Health = 0x20, /// <summary> - /// OpenSocial + /// Google OpenSocial /// </summary> OpenSocial = 0x40, @@ -116,7 +116,7 @@ namespace DotNetOpenAuth.ApplicationBlock { WebmasterTools = 0x200, /// <summary> - /// YouTube + /// YouTube service /// </summary> YouTube = 0x400, @@ -136,7 +136,7 @@ namespace DotNetOpenAuth.ApplicationBlock { GoogleBase = 0x2000, /// <summary> - /// Analytics + /// Google Analytics /// </summary> Analytics = 0x4000, } diff --git a/samples/OAuthServiceProvider/Members/Authorize.aspx.cs b/samples/OAuthServiceProvider/Members/Authorize.aspx.cs index 68dba5a..b3094c9 100644 --- a/samples/OAuthServiceProvider/Members/Authorize.aspx.cs +++ b/samples/OAuthServiceProvider/Members/Authorize.aspx.cs @@ -1,13 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Security.Cryptography; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DotNetOpenAuth; using DotNetOpenAuth.OAuth; using DotNetOpenAuth.OAuth.Messages; -using System.Security.Cryptography; /// <summary> /// Conducts the user through a Consumer authorization process. diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs index cecec48..449a033 100644 --- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs +++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs @@ -193,7 +193,6 @@ namespace DotNetOpenAuth.Test.ChannelElements { Timestamp = DateTime.UtcNow, HttpMethods = HttpDeliveryMethods.AuthorizationHeaderRequest, }; - // ExtraData should appear in the form since this is a POST request, // and only official message parts get a place in the Authorization header. diff --git a/src/DotNetOpenAuth/Configuration/TypeConfigurationCollection.cs b/src/DotNetOpenAuth/Configuration/TypeConfigurationCollection.cs index 00eeb15..f8813b5 100644 --- a/src/DotNetOpenAuth/Configuration/TypeConfigurationCollection.cs +++ b/src/DotNetOpenAuth/Configuration/TypeConfigurationCollection.cs @@ -14,7 +14,7 @@ namespace DotNetOpenAuth.Configuration { using DotNetOpenAuth.Messaging; /// <summary> - /// A collection of <see cref="TypeConfigurationElement"/>. + /// A collection of <see cref="TypeConfigurationElement<T>"/>. /// </summary> /// <typeparam name="T">The type that all types specified in the elements must derive from.</typeparam> [ContractVerification(true)] diff --git a/src/DotNetOpenAuth/Messaging/Channel.cs b/src/DotNetOpenAuth/Messaging/Channel.cs index 4601949..1b9e8da 100644 --- a/src/DotNetOpenAuth/Messaging/Channel.cs +++ b/src/DotNetOpenAuth/Messaging/Channel.cs @@ -429,6 +429,22 @@ namespace DotNetOpenAuth.Messaging { #endregion /// <summary> + /// Gets the current HTTP request being processed. + /// </summary> + /// <returns>The HttpRequestInfo for the current request.</returns> + /// <remarks> + /// Requires an <see cref="HttpContext.Current"/> context. + /// </remarks> + /// <exception cref="InvalidOperationException">Thrown if <see cref="HttpContext.Current">HttpContext.Current</see> == <c>null</c>.</exception> + [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Costly call should not be a property.")] + protected internal virtual HttpRequestInfo GetRequestFromContext() { + Contract.Ensures(Contract.Result<HttpRequestInfo>() != null); + ErrorUtilities.VerifyHttpContext(); + + return new HttpRequestInfo(HttpContext.Current.Request); + } + + /// <summary> /// Checks whether a given HTTP method is expected to include an entity body in its request. /// </summary> /// <param name="httpMethod">The HTTP method.</param> @@ -447,22 +463,6 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> - /// Gets the current HTTP request being processed. - /// </summary> - /// <returns>The HttpRequestInfo for the current request.</returns> - /// <remarks> - /// Requires an <see cref="HttpContext.Current"/> context. - /// </remarks> - /// <exception cref="InvalidOperationException">Thrown if <see cref="HttpContext.Current">HttpContext.Current</see> == <c>null</c>.</exception> - [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Costly call should not be a property.")] - protected internal virtual HttpRequestInfo GetRequestFromContext() { - Contract.Ensures(Contract.Result<HttpRequestInfo>() != null); - ErrorUtilities.VerifyHttpContext(); - - return new HttpRequestInfo(HttpContext.Current.Request); - } - - /// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> @@ -826,7 +826,7 @@ namespace DotNetOpenAuth.Messaging { HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(requestMessage.Recipient); httpRequest.CachePolicy = this.CachePolicy; httpRequest.Method = "POST"; - SendParametersInEntity(httpRequest, fields); + this.SendParametersInEntity(httpRequest, fields); return httpRequest; } diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs index 5171a0b..8bcae3e 100644 --- a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs +++ b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs @@ -259,7 +259,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { /// </summary> /// <param name="message">The message.</param> /// <returns>"POST", "GET" or some other similar http verb.</returns> - private string GetHttpMethod(IDirectedProtocolMessage message) { + private static string GetHttpMethod(IDirectedProtocolMessage message) { Contract.Requires(message != null); ErrorUtilities.VerifyArgumentNotNull(message, "message"); diff --git a/src/DotNetOpenAuth/OAuth/ConsumerBase.cs b/src/DotNetOpenAuth/OAuth/ConsumerBase.cs index d1a4054..5395a6a 100644 --- a/src/DotNetOpenAuth/OAuth/ConsumerBase.cs +++ b/src/DotNetOpenAuth/OAuth/ConsumerBase.cs @@ -106,6 +106,27 @@ namespace DotNetOpenAuth.OAuth { /// <param name="endpoint">The URL and method on the Service Provider to send the request to.</param> /// <param name="accessToken">The access token that permits access to the protected resource.</param> /// <returns>The initialized WebRequest object.</returns> + public AccessProtectedResourceRequest CreateAuthorizingMessage(MessageReceivingEndpoint endpoint, string accessToken) { + Contract.Requires(endpoint != null); + Contract.Requires(!String.IsNullOrEmpty(accessToken)); + ErrorUtilities.VerifyArgumentNotNull(endpoint, "endpoint"); + ErrorUtilities.VerifyNonZeroLength(accessToken, "accessToken"); + + AccessProtectedResourceRequest message = new AccessProtectedResourceRequest(endpoint) { + AccessToken = accessToken, + ConsumerKey = this.ConsumerKey, + }; + + return message; + } + + /// <summary> + /// Creates a web request prepared with OAuth authorization + /// that may be further tailored by adding parameters by the caller. + /// </summary> + /// <param name="endpoint">The URL and method on the Service Provider to send the request to.</param> + /// <param name="accessToken">The access token that permits access to the protected resource.</param> + /// <returns>The initialized WebRequest object.</returns> /// <exception cref="WebException">Thrown if the request fails for any reason after it is sent to the Service Provider.</exception> public IncomingWebResponse PrepareAuthorizedRequestAndSend(MessageReceivingEndpoint endpoint, string accessToken) { IDirectedProtocolMessage message = this.CreateAuthorizingMessage(endpoint, accessToken); @@ -160,27 +181,6 @@ namespace DotNetOpenAuth.OAuth { } /// <summary> - /// Creates a web request prepared with OAuth authorization - /// that may be further tailored by adding parameters by the caller. - /// </summary> - /// <param name="endpoint">The URL and method on the Service Provider to send the request to.</param> - /// <param name="accessToken">The access token that permits access to the protected resource.</param> - /// <returns>The initialized WebRequest object.</returns> - public AccessProtectedResourceRequest CreateAuthorizingMessage(MessageReceivingEndpoint endpoint, string accessToken) { - Contract.Requires(endpoint != null); - Contract.Requires(!String.IsNullOrEmpty(accessToken)); - ErrorUtilities.VerifyArgumentNotNull(endpoint, "endpoint"); - ErrorUtilities.VerifyNonZeroLength(accessToken, "accessToken"); - - AccessProtectedResourceRequest message = new AccessProtectedResourceRequest(endpoint) { - AccessToken = accessToken, - ConsumerKey = this.ConsumerKey, - }; - - return message; - } - - /// <summary> /// Exchanges a given request token for access token. /// </summary> /// <param name="requestToken">The request token that the user has authorized.</param> diff --git a/src/DotNetOpenAuth/OpenId/ChannelElements/IOpenIdExtensionFactory.cs b/src/DotNetOpenAuth/OpenId/ChannelElements/IOpenIdExtensionFactory.cs index 31223a0..762fc9a 100644 --- a/src/DotNetOpenAuth/OpenId/ChannelElements/IOpenIdExtensionFactory.cs +++ b/src/DotNetOpenAuth/OpenId/ChannelElements/IOpenIdExtensionFactory.cs @@ -8,6 +8,8 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { using System.Collections.Generic; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Messages; + using DotNetOpenAuth.OpenId.Provider; + using DotNetOpenAuth.OpenId.RelyingParty; /// <summary> /// OpenID extension factory class for creating extensions based on received Type URIs. diff --git a/src/DotNetOpenAuth/OpenId/Messages/IOpenIdMessageExtension.cs b/src/DotNetOpenAuth/OpenId/Messages/IOpenIdMessageExtension.cs index 70b6758..fb984fe 100644 --- a/src/DotNetOpenAuth/OpenId/Messages/IOpenIdMessageExtension.cs +++ b/src/DotNetOpenAuth/OpenId/Messages/IOpenIdMessageExtension.cs @@ -16,7 +16,7 @@ namespace DotNetOpenAuth.OpenId.Messages { /// </summary> /// <remarks> /// Classes that implement this interface should be marked as - /// [<see cref="Serializable"/>] to allow serializing state servers + /// [<see cref="SerializableAttribute"/>] to allow serializing state servers /// to cache messages, particularly responses. /// </remarks> public interface IOpenIdMessageExtension : IExtensionMessage { diff --git a/src/DotNetOpenAuth/OpenId/OpenIdUtilities.cs b/src/DotNetOpenAuth/OpenId/OpenIdUtilities.cs index 3c5f00d..f09bbe1 100644 --- a/src/DotNetOpenAuth/OpenId/OpenIdUtilities.cs +++ b/src/DotNetOpenAuth/OpenId/OpenIdUtilities.cs @@ -16,6 +16,8 @@ namespace DotNetOpenAuth.OpenId { using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.ChannelElements; using DotNetOpenAuth.OpenId.Extensions; + using DotNetOpenAuth.OpenId.Provider; + using DotNetOpenAuth.OpenId.RelyingParty; /// <summary> /// A set of utilities especially useful to OpenID. |