summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2013-03-23 09:06:14 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2013-03-23 09:06:14 -0700
commitbaef63e68ff40462a8be63b6fcb7ad6265b247b6 (patch)
treed66316cf4b69042a14e80ea6a60d1085a23d054a /src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs
parent5be8a1353fbf22a0bf9a3c414b6166c42e1c844d (diff)
downloadDotNetOpenAuth-baef63e68ff40462a8be63b6fcb7ad6265b247b6.zip
DotNetOpenAuth-baef63e68ff40462a8be63b6fcb7ad6265b247b6.tar.gz
DotNetOpenAuth-baef63e68ff40462a8be63b6fcb7ad6265b247b6.tar.bz2
Adds a cookie delegating handler, fixes tests.
Diffstat (limited to 'src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs')
-rw-r--r--src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs b/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs
index 2befd35..59d82d5 100644
--- a/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth2/WebServerClientAuthorizeTests.cs
@@ -38,11 +38,12 @@ namespace DotNetOpenAuth.Test.OAuth2 {
return await server.HandleTokenRequestAsync(req, ct);
});
- var client = new WebServerClient(AuthorizationServerDescription);
+ var client = new WebServerClient(AuthorizationServerDescription, ClientId, ClientSecret, this.HostFactories);
var authState = new AuthorizationState(TestScopes) {
Callback = ClientCallback,
};
var authRequestRedirect = await client.PrepareRequestUserAuthorizationAsync(authState);
+ this.HostFactories.CookieContainer.SetCookies(authRequestRedirect, ClientCallback);
Uri authRequestResponse;
using (var httpClient = this.HostFactories.CreateHttpClient()) {
using (var httpResponse = await httpClient.GetAsync(authRequestRedirect.Headers.Location)) {
@@ -50,7 +51,9 @@ namespace DotNetOpenAuth.Test.OAuth2 {
}
}
- var result = await client.ProcessUserAuthorizationAsync(new HttpRequestMessage(HttpMethod.Get, authRequestResponse), CancellationToken.None);
+ var authorizationResponse = new HttpRequestMessage(HttpMethod.Get, authRequestResponse);
+ this.HostFactories.CookieContainer.ApplyCookies(authorizationResponse);
+ var result = await client.ProcessUserAuthorizationAsync(authorizationResponse, CancellationToken.None);
Assert.That(result.AccessToken, Is.Not.Null.And.Not.Empty);
Assert.That(result.RefreshToken, Is.Not.Null.And.Not.Empty);
}