summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth.Test/OAuthWrap/MessageFactoryTests.cs4
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/IAuthorizationState.cs67
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/IClientTokenManager.cs60
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenFailedResponse.cs6
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenSuccessResponse.cs45
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentFailedResponse.cs5
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentSuccessResponse.cs2
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/WebAppClient.cs5
-rw-r--r--src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs3
9 files changed, 106 insertions, 91 deletions
diff --git a/src/DotNetOpenAuth.Test/OAuthWrap/MessageFactoryTests.cs b/src/DotNetOpenAuth.Test/OAuthWrap/MessageFactoryTests.cs
index bf77f7e..0733600 100644
--- a/src/DotNetOpenAuth.Test/OAuthWrap/MessageFactoryTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuthWrap/MessageFactoryTests.cs
@@ -19,9 +19,9 @@ namespace DotNetOpenAuth.Test.OAuthWrap {
/// Verifies that the WRAP message types are recognized.
/// </summary>
public class MessageFactoryTests : OAuthWrapTestBase {
+ private readonly MessageReceivingEndpoint recipient = new MessageReceivingEndpoint("http://who", HttpDeliveryMethods.PostRequest);
private OAuthWrapChannel channel;
private IMessageFactory messageFactory;
- private readonly MessageReceivingEndpoint recipient = new MessageReceivingEndpoint("http://who", HttpDeliveryMethods.PostRequest);
public override void SetUp() {
base.SetUp();
@@ -112,7 +112,7 @@ namespace DotNetOpenAuth.Test.OAuthWrap {
[TestCase, Ignore("Not implemented")]
public void WebAppAccessTokenFailedResponse() {
- // HTTP 400 Bad Request
+ // HTTP 400 Bad Request
}
[TestCase, Ignore("Not implemented")]
diff --git a/src/DotNetOpenAuth/OAuthWrap/IAuthorizationState.cs b/src/DotNetOpenAuth/OAuthWrap/IAuthorizationState.cs
new file mode 100644
index 0000000..7e86b5b
--- /dev/null
+++ b/src/DotNetOpenAuth/OAuthWrap/IAuthorizationState.cs
@@ -0,0 +1,67 @@
+//-----------------------------------------------------------------------
+// <copyright file="IAuthorizationState.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.OAuthWrap
+{
+ using System;
+
+ /// <summary>
+ /// Provides access to a persistent object that tracks the state of an authorization.
+ /// </summary>
+ public interface IAuthorizationState {
+ /// <summary>
+ /// Gets or sets the callback URL used to obtain authorization.
+ /// </summary>
+ /// <value>The callback URL.</value>
+ Uri Callback { get; set; }
+
+ /// <summary>
+ /// Gets or sets the long-lived token used to renew the short-lived <see cref="AccessToken"/>.
+ /// </summary>
+ /// <value>The refresh token.</value>
+ string RefreshToken { get; set; }
+
+ /// <summary>
+ /// Gets or sets the access token.
+ /// </summary>
+ /// <value>The access token.</value>
+ string AccessToken { get; set; }
+
+ /// <summary>
+ /// Gets or sets the access token secret.
+ /// </summary>
+ /// <value>The access token secret.</value>
+ string AccessTokenSecret { get; set; }
+
+ /// <summary>
+ /// Gets or sets the access token UTC expiration date.
+ /// </summary>
+ DateTime? AccessTokenExpirationUtc { get; set; }
+
+ /// <summary>
+ /// Gets or sets the scope the token is (to be) authorized for.
+ /// </summary>
+ /// <value>The scope.</value>
+ string Scope { get; set; }
+
+ /// <summary>
+ /// Deletes this authorization, including access token and refresh token where applicable.
+ /// </summary>
+ /// <remarks>
+ /// This method is invoked when an authorization attempt fails, is rejected, is revoked, or
+ /// expires and cannot be renewed.
+ /// </remarks>
+ void Delete();
+
+ /// <summary>
+ /// Saves any changes made to this authorization object's properties.
+ /// </summary>
+ /// <remarks>
+ /// This method is invoked after DotNetOpenAuth changes any property.
+ /// </remarks>
+ void SaveChanges();
+ }
+} \ No newline at end of file
diff --git a/src/DotNetOpenAuth/OAuthWrap/IClientTokenManager.cs b/src/DotNetOpenAuth/OAuthWrap/IClientTokenManager.cs
index 42b7e01..3b593e3 100644
--- a/src/DotNetOpenAuth/OAuthWrap/IClientTokenManager.cs
+++ b/src/DotNetOpenAuth/OAuthWrap/IClientTokenManager.cs
@@ -24,6 +24,9 @@ namespace DotNetOpenAuth.OAuthWrap {
/// </summary>
[ContractClassFor(typeof(IClientTokenManager))]
internal abstract class IClientTokenManagerContract : IClientTokenManager {
+ /// <summary>
+ /// Prevents a default instance of the <see cref="IClientTokenManagerContract"/> class from being created.
+ /// </summary>
private IClientTokenManagerContract() {
}
@@ -36,61 +39,4 @@ namespace DotNetOpenAuth.OAuthWrap {
#endregion
}
-
- /// <summary>
- /// Provides access to a persistent object that tracks the state of an authorization.
- /// </summary>
- public interface IAuthorizationState {
- /// <summary>
- /// Gets or sets the callback URL used to obtain authorization.
- /// </summary>
- /// <value>The callback URL.</value>
- Uri Callback { get; set; }
-
- /// <summary>
- /// Gets or sets the long-lived token used to renew the short-lived <see cref="AccessToken"/>.
- /// </summary>
- /// <value>The refresh token.</value>
- string RefreshToken { get; set; }
-
- /// <summary>
- /// Gets or sets the access token.
- /// </summary>
- /// <value>The access token.</value>
- string AccessToken { get; set; }
-
- /// <summary>
- /// Gets or sets the access token secret.
- /// </summary>
- /// <value>The access token secret.</value>
- string AccessTokenSecret { get; set; }
-
- /// <summary>
- /// Gets or sets the access token UTC expiration date.
- /// </summary>
- DateTime? AccessTokenExpirationUtc { get; set; }
-
- /// <summary>
- /// Gets or sets the scope the token is (to be) authorized for.
- /// </summary>
- /// <value>The scope.</value>
- string Scope { get; set; }
-
- /// <summary>
- /// Deletes this authorization, including access token and refresh token where applicable.
- /// </summary>
- /// <remarks>
- /// This method is invoked when an authorization attempt fails, is rejected, is revoked, or
- /// expires and cannot be renewed.
- /// </remarks>
- void Delete();
-
- /// <summary>
- /// Saves any changes made to this authorization object's properties.
- /// </summary>
- /// <remarks>
- /// This method is invoked after DotNetOpenAuth changes any property.
- /// </remarks>
- void SaveChanges();
- }
}
diff --git a/src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenFailedResponse.cs b/src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenFailedResponse.cs
index 9455d53..c487ebc 100644
--- a/src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenFailedResponse.cs
+++ b/src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenFailedResponse.cs
@@ -1,12 +1,12 @@
//-----------------------------------------------------------------------
-// <copyright file="RefreshAccessTokenFailedResponse.cs" company="Andrew Arnott">
+// <copyright file="AccessTokenFailedResponse.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
-using DotNetOpenAuth.Messaging;
-
namespace DotNetOpenAuth.OAuthWrap.Messages {
+ using DotNetOpenAuth.Messaging;
+
/// <summary>
/// A response from the Authorization Server to the Client to indicate that a
/// request for an access token renewal failed, probably due to an invalid
diff --git a/src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenSuccessResponse.cs b/src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenSuccessResponse.cs
index ad59483..3c2714a 100644
--- a/src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenSuccessResponse.cs
+++ b/src/DotNetOpenAuth/OAuthWrap/Messages/AccessTokenSuccessResponse.cs
@@ -4,10 +4,9 @@
// </copyright>
//-----------------------------------------------------------------------
-using System.Net;
-
namespace DotNetOpenAuth.OAuthWrap.Messages {
using System;
+ using System.Net;
using DotNetOpenAuth.Messaging;
/// <summary>
@@ -27,6 +26,27 @@ namespace DotNetOpenAuth.OAuthWrap.Messages {
}
/// <summary>
+ /// Gets the HTTP status code that the direct response should be sent with.
+ /// </summary>
+ /// <value>Always HttpStatusCode.OK</value>
+ HttpStatusCode IHttpDirectResponse.HttpStatusCode {
+ get { return HttpStatusCode.OK; }
+ }
+
+ /// <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
+ {
+ { HttpResponseHeader.CacheControl, "no-store" },
+ };
+ }
+ }
+
+ /// <summary>
/// Gets or sets the access token.
/// </summary>
/// <value>The access token.</value>
@@ -59,26 +79,5 @@ namespace DotNetOpenAuth.OAuthWrap.Messages {
/// </remarks>
[MessagePart(Protocol.access_token_secret, IsRequired = false, AllowEmpty = false)]
internal string AccessTokenSecret { get; set; }
-
- /// <summary>
- /// Gets the HTTP status code that the direct response should be sent with.
- /// </summary>
- /// <value>HttpStatusCode.OK</value>
- HttpStatusCode IHttpDirectResponse.HttpStatusCode {
- get { return HttpStatusCode.OK; }
- }
-
- /// <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
- {
- { HttpResponseHeader.CacheControl, "no-store" },
- };
- }
- }
}
}
diff --git a/src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentFailedResponse.cs b/src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentFailedResponse.cs
index 8f08739..5547946 100644
--- a/src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentFailedResponse.cs
+++ b/src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentFailedResponse.cs
@@ -18,6 +18,11 @@ namespace DotNetOpenAuth.OAuthWrap.Messages {
[MessagePart(Protocol.error, IsRequired = true)]
private const string ErrorReason = Protocol.user_denied;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="UserAgentFailedResponse"/> class.
+ /// </summary>
+ /// <param name="clientCallback">The client callback.</param>
+ /// <param name="version">The version.</param>
internal UserAgentFailedResponse(Uri clientCallback, Version version)
: base(version, MessageTransport.Indirect, clientCallback) {
}
diff --git a/src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentSuccessResponse.cs b/src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentSuccessResponse.cs
index c8f073f..9b55647 100644
--- a/src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentSuccessResponse.cs
+++ b/src/DotNetOpenAuth/OAuthWrap/Messages/UserAgent/UserAgentSuccessResponse.cs
@@ -18,7 +18,7 @@ namespace DotNetOpenAuth.OAuthWrap.Messages {
/// <param name="clientCallback">The client callback.</param>
/// <param name="version">The version.</param>
internal UserAgentSuccessResponse(Uri clientCallback, Version version)
- : base (version, MessageTransport.Indirect, clientCallback)
+ : base(version, MessageTransport.Indirect, clientCallback)
{
}
diff --git a/src/DotNetOpenAuth/OAuthWrap/WebAppClient.cs b/src/DotNetOpenAuth/OAuthWrap/WebAppClient.cs
index 08af228..8df71b9 100644
--- a/src/DotNetOpenAuth/OAuthWrap/WebAppClient.cs
+++ b/src/DotNetOpenAuth/OAuthWrap/WebAppClient.cs
@@ -4,13 +4,12 @@
// </copyright>
//-----------------------------------------------------------------------
-using System.Net;
-
namespace DotNetOpenAuth.OAuthWrap {
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
+ using System.Net;
using System.Text;
using System.Web;
using DotNetOpenAuth.Messaging;
@@ -41,7 +40,7 @@ namespace DotNetOpenAuth.OAuthWrap {
public IClientTokenManager TokenManager { get; set; }
public WebAppRequest PrepareRequestUserAuthorization() {
- return PrepareRequestUserAuthorization(new AuthorizationState());
+ return this.PrepareRequestUserAuthorization(new AuthorizationState());
}
public WebAppRequest PrepareRequestUserAuthorization(IAuthorizationState authorization) {
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs
index 77d8ae1..09383bb 100644
--- a/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs
+++ b/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs
@@ -4,8 +4,6 @@
// </copyright>
//-----------------------------------------------------------------------
-using System.Threading;
-
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
@@ -13,6 +11,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
+ using System.Threading;
using System.Web;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.ChannelElements;