diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-26 07:45:42 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-07-26 07:45:42 -0700 |
commit | 08d6900d3de1f68d77e1253913d66734b7b42a0c (patch) | |
tree | 6fa161e694de71bec8dcb02aaa3a2e53641284fb /src | |
parent | cb8528f3bace8ffdc11c6b0c5d5a460697fa48c9 (diff) | |
download | DotNetOpenAuth-08d6900d3de1f68d77e1253913d66734b7b42a0c.zip DotNetOpenAuth-08d6900d3de1f68d77e1253913d66734b7b42a0c.tar.gz DotNetOpenAuth-08d6900d3de1f68d77e1253913d66734b7b42a0c.tar.bz2 |
StyleCop fixes
Diffstat (limited to 'src')
12 files changed, 41 insertions, 52 deletions
diff --git a/src/DotNetOpenAuth/OAuth2/AuthorizationServerDescription.cs b/src/DotNetOpenAuth/OAuth2/AuthorizationServerDescription.cs index 756c980..8979b23 100644 --- a/src/DotNetOpenAuth/OAuth2/AuthorizationServerDescription.cs +++ b/src/DotNetOpenAuth/OAuth2/AuthorizationServerDescription.cs @@ -11,7 +11,7 @@ namespace DotNetOpenAuth.OAuth2 { using System.Text; /// <summary> - /// A description of an OAuth Authorization Server. + /// A description of an OAuth Authorization Server as seen by an OAuth Client. /// </summary> public class AuthorizationServerDescription { /// <summary> diff --git a/src/DotNetOpenAuth/OAuth2/AuthorizationState.cs b/src/DotNetOpenAuth/OAuth2/AuthorizationState.cs index 7682900..dda5f5e 100644 --- a/src/DotNetOpenAuth/OAuth2/AuthorizationState.cs +++ b/src/DotNetOpenAuth/OAuth2/AuthorizationState.cs @@ -56,7 +56,7 @@ namespace DotNetOpenAuth.OAuth2 { public DateTime? AccessTokenIssueDateUtc { get; set; } /// <summary> - /// Gets or sets the scope the token is (to be) authorized for. + /// Gets the scope the token is (to be) authorized for. /// </summary> /// <value>The scope.</value> public HashSet<string> Scope { get; private set; } diff --git a/src/DotNetOpenAuth/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs b/src/DotNetOpenAuth/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs index 21fc258..58f3d42 100644 --- a/src/DotNetOpenAuth/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs +++ b/src/DotNetOpenAuth/OAuth2/ChannelElements/AuthorizationCodeBindingElement.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="WebServerVerificationCodeBindingElement.cs" company="Andrew Arnott"> +// <copyright file="AuthorizationCodeBindingElement.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth/OAuth2/ChannelElements/AuthorizationDataBag.cs b/src/DotNetOpenAuth/OAuth2/ChannelElements/AuthorizationDataBag.cs index 2ca8c34..33dde2f 100644 --- a/src/DotNetOpenAuth/OAuth2/ChannelElements/AuthorizationDataBag.cs +++ b/src/DotNetOpenAuth/OAuth2/ChannelElements/AuthorizationDataBag.cs @@ -47,7 +47,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements { public string User { get; set; } /// <summary> - /// Gets or sets the scope of operations the client is allowed to invoke. + /// Gets the scope of operations the client is allowed to invoke. /// </summary> [MessagePart(Encoder = typeof(ScopeEncoder))] public HashSet<string> Scope { get; private set; } diff --git a/src/DotNetOpenAuth/OAuth2/IAuthorizationState.cs b/src/DotNetOpenAuth/OAuth2/IAuthorizationState.cs index 68a109b..39437ac 100644 --- a/src/DotNetOpenAuth/OAuth2/IAuthorizationState.cs +++ b/src/DotNetOpenAuth/OAuth2/IAuthorizationState.cs @@ -42,7 +42,7 @@ namespace DotNetOpenAuth.OAuth2 { DateTime? AccessTokenExpirationUtc { get; set; } /// <summary> - /// Gets or sets the scope the token is (to be) authorized for. + /// Gets the scope the token is (to be) authorized for. /// </summary> /// <value>The scope.</value> HashSet<string> Scope { get; } diff --git a/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs b/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs index 86c1a4b..559d557 100644 --- a/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs +++ b/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs @@ -31,10 +31,6 @@ namespace DotNetOpenAuth.OAuth2.Messages { Contract.Requires<ArgumentNullException>(authorizationServer != null, "authorizationServer"); } - internal override GrantType GrantType { - get { return Messages.GrantType.AuthorizationCode; } - } - /// <summary> /// Gets the type of the code or token. /// </summary> @@ -57,6 +53,10 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// </summary> IAuthorizationDescription ITokenCarryingRequest.AuthorizationDescription { get; set; } + internal override GrantType GrantType { + get { return Messages.GrantType.AuthorizationCode; } + } + /// <summary> /// Gets or sets the verification code previously communicated to the Client /// in <see cref="EndUserAuthorizationSuccessAuthCodeResponse.AuthorizationCode"/>. diff --git a/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenClientCredentialsRequest.cs b/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenClientCredentialsRequest.cs index 59b0758..f0bc76d 100644 --- a/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenClientCredentialsRequest.cs +++ b/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenClientCredentialsRequest.cs @@ -30,6 +30,10 @@ namespace DotNetOpenAuth.OAuth2.Messages { this.HttpMethods = HttpDeliveryMethods.PostRequest; } + internal override GrantType GrantType { + get { return Messages.GrantType.None; } + } + /// <summary> /// Checks the message state for conformity to the protocol specification /// and throws an exception if the message is invalid. @@ -46,9 +50,5 @@ namespace DotNetOpenAuth.OAuth2.Messages { base.EnsureValidMessage(); ErrorUtilities.VerifyProtocol(this.Recipient.IsTransportSecure(), OAuthStrings.HttpsRequired); } - - internal override GrantType GrantType { - get { return Messages.GrantType.None; } - } } } diff --git a/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenFailedResponse.cs b/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenFailedResponse.cs index 90c5e67..8903527 100644 --- a/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenFailedResponse.cs +++ b/src/DotNetOpenAuth/OAuth2/Messages/AccessTokenFailedResponse.cs @@ -43,6 +43,25 @@ namespace DotNetOpenAuth.OAuth2.Messages { this.invalidClientCredentialsInAuthorizationHeader = invalidClientCredentialsInAuthorizationHeader; } + #region IHttpDirectResponse Members + + /// <summary> + /// Gets the HTTP status code that the direct response should be sent with. + /// </summary> + HttpStatusCode IHttpDirectResponse.HttpStatusCode { + get { return this.invalidClientCredentialsInAuthorizationHeader ? HttpStatusCode.Unauthorized : HttpStatusCode.BadRequest; } + } + + /// <summary> + /// Gets the HTTP headers to add to the response. + /// </summary> + /// <value>May be an empty collection, but must not be <c>null</c>.</value> + WebHeaderCollection IHttpDirectResponse.Headers { + get { return new WebHeaderCollection(); } + } + + #endregion + /// <summary> /// Gets or sets the error. /// </summary> @@ -63,24 +82,5 @@ namespace DotNetOpenAuth.OAuth2.Messages { /// <value>A URI identifying a human-readable web page with information about the error, used to provide the end-user with additional information about the error.</value> [MessagePart(Protocol.error_uri, AllowEmpty = false, IsRequired = false)] internal Uri ErrorUri { get; set; } - - #region IHttpDirectResponse Members - - /// <summary> - /// Gets the HTTP status code that the direct response should be sent with. - /// </summary> - HttpStatusCode IHttpDirectResponse.HttpStatusCode { - get { return this.invalidClientCredentialsInAuthorizationHeader ? HttpStatusCode.Unauthorized : HttpStatusCode.BadRequest; } - } - - /// <summary> - /// Gets the HTTP headers to add to the response. - /// </summary> - /// <value>May be an empty collection, but must not be <c>null</c>.</value> - WebHeaderCollection IHttpDirectResponse.Headers { - get { return new WebHeaderCollection(); } - } - - #endregion } } diff --git a/src/DotNetOpenAuth/OAuth2/Messages/AuthenticatedClientRequestBase.cs b/src/DotNetOpenAuth/OAuth2/Messages/AuthenticatedClientRequestBase.cs index 53a087c..66809f8 100644 --- a/src/DotNetOpenAuth/OAuth2/Messages/AuthenticatedClientRequestBase.cs +++ b/src/DotNetOpenAuth/OAuth2/Messages/AuthenticatedClientRequestBase.cs @@ -23,7 +23,7 @@ namespace DotNetOpenAuth.OAuth2.Messages { } /// <summary> - /// Gets or sets the client identifier previously obtained from the Authorization Server. + /// Gets the client identifier previously obtained from the Authorization Server. /// </summary> /// <value>The client identifier.</value> [MessagePart(Protocol.client_id, IsRequired = true, AllowEmpty = false)] diff --git a/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs b/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs index 5ef501b..076fc42 100644 --- a/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs +++ b/src/DotNetOpenAuth/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs @@ -43,12 +43,6 @@ namespace DotNetOpenAuth.OAuth2.Messages { ((IMessageWithClientState)this).ClientState = request.ClientState; } - [MessagePart(Protocol.code, AllowEmpty = false, IsRequired = true)] - internal string AuthorizationCode { get; set; } - - [MessagePart(Protocol.access_token, AllowEmpty = false, IsRequired = false)] - internal string AccessToken { get; set; } - #region ITokenCarryingRequest Members string ITokenCarryingRequest.CodeOrToken { @@ -63,5 +57,11 @@ namespace DotNetOpenAuth.OAuth2.Messages { IAuthorizationDescription ITokenCarryingRequest.AuthorizationDescription { get; set; } #endregion + + [MessagePart(Protocol.code, AllowEmpty = false, IsRequired = true)] + internal string AuthorizationCode { get; set; } + + [MessagePart(Protocol.access_token, AllowEmpty = false, IsRequired = false)] + internal string AccessToken { get; set; } } } diff --git a/src/DotNetOpenAuth/OAuth2/OAuthUtilities.cs b/src/DotNetOpenAuth/OAuth2/OAuthUtilities.cs index 6b4c42a..79ef278 100644 --- a/src/DotNetOpenAuth/OAuth2/OAuthUtilities.cs +++ b/src/DotNetOpenAuth/OAuth2/OAuthUtilities.cs @@ -18,6 +18,8 @@ namespace DotNetOpenAuth.OAuth2 { /// Some common utility methods for OAuth 2.0. /// </summary> public static class OAuthUtilities { + public static readonly StringComparer ScopeStringComparer = StringComparer.Ordinal; + /// <summary> /// The delimiter between scope elements. /// </summary> @@ -34,8 +36,6 @@ namespace DotNetOpenAuth.OAuth2 { MessagingUtilities.Digits + @"!#$%&'()*+-./:<=>?@[]^_`{|}~\,;"; - public static readonly StringComparer ScopeStringComparer = StringComparer.Ordinal; - /// <summary> /// Determines whether one given scope is a subset of another scope. /// </summary> diff --git a/src/DotNetOpenAuth/OAuth2/ResourceServer.cs b/src/DotNetOpenAuth/OAuth2/ResourceServer.cs index a2afdae..f861582 100644 --- a/src/DotNetOpenAuth/OAuth2/ResourceServer.cs +++ b/src/DotNetOpenAuth/OAuth2/ResourceServer.cs @@ -41,17 +41,6 @@ namespace DotNetOpenAuth.OAuth2 { public IAccessTokenAnalyzer AccessTokenAnalyzer { get; private set; } /// <summary> - /// Gets or sets the endpoint information for an authorization server that may be used - /// to obtain an access token for this resource. - /// </summary> - /// <value>The authorization server description.</value> - /// <remarks> - /// This value is optional. If set, this information will be used to generate - /// more useful HTTP 401 Unauthorized responses for requests that lack an OAuth access token. - /// </remarks> - public AuthorizationServerDescription AuthorizationServerDescription { get; set; } - - /// <summary> /// Gets the channel. /// </summary> /// <value>The channel.</value> |