diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-15 14:31:08 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-15 14:31:08 -0700 |
commit | f609820f0486cf92edab48c3fbd5adfc133263bc (patch) | |
tree | 56d1ebda5f75be8d572e0a093b311a81bc920e16 | |
parent | 139c9be97c1ecc42e98426f8bf888eff2ab64659 (diff) | |
download | DotNetOpenAuth-f609820f0486cf92edab48c3fbd5adfc133263bc.zip DotNetOpenAuth-f609820f0486cf92edab48c3fbd5adfc133263bc.tar.gz DotNetOpenAuth-f609820f0486cf92edab48c3fbd5adfc133263bc.tar.bz2 |
Renamed UserAgentResponse to OutgoingWebResponse, and DirectWebResponse to IncomingWebResponse.
32 files changed, 115 insertions, 115 deletions
diff --git a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj index 8c3f4fa..af0ef37 100644 --- a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj +++ b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj @@ -120,7 +120,7 @@ <Compile Include="Mocks\AssociateUnencryptedRequestNoSslCheck.cs" /> <Compile Include="Mocks\CoordinatingChannel.cs" /> <Compile Include="Mocks\CoordinatingHttpRequestInfo.cs" /> - <Compile Include="Mocks\CoordinatingUserAgentResponse.cs" /> + <Compile Include="Mocks\CoordinatingOutgoingWebResponse.cs" /> <Compile Include="Mocks\InMemoryTokenManager.cs" /> <Compile Include="Mocks\MockHttpRequest.cs" /> <Compile Include="Mocks\MockIdentifier.cs" /> @@ -254,4 +254,4 @@ </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\tools\DotNetOpenAuth.Versioning.targets" /> -</Project> +</Project>
\ No newline at end of file diff --git a/src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs b/src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs index c8f5cbe..8039b21 100644 --- a/src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs +++ b/src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs @@ -75,7 +75,7 @@ namespace DotNetOpenAuth.Test.Messaging { message.Recipient = new Uri("http://provider/path"); var expected = GetStandardTestFields(FieldFill.CompleteBeforeBindings); - UserAgentResponse response = this.Channel.PrepareResponse(message); + OutgoingWebResponse response = this.Channel.PrepareResponse(message); Assert.AreEqual(HttpStatusCode.Redirect, response.Status); StringAssert.StartsWith(response.Headers[HttpResponseHeader.Location], "http://provider/path"); foreach (var pair in expected) { @@ -118,7 +118,7 @@ namespace DotNetOpenAuth.Test.Messaging { Location = new Uri("http://host/path"), Recipient = new Uri("http://provider/path"), }; - UserAgentResponse response = this.Channel.PrepareResponse(message); + OutgoingWebResponse response = this.Channel.PrepareResponse(message); Assert.AreEqual(HttpStatusCode.OK, response.Status, "A form redirect should be an HTTP successful response."); Assert.IsNull(response.Headers[HttpResponseHeader.Location], "There should not be a redirection header in the response."); string body = response.Body; diff --git a/src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs b/src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs index 4320a1b..a0e7c3f 100644 --- a/src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs +++ b/src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs @@ -15,7 +15,7 @@ namespace DotNetOpenAuth.Test.Messaging { public class ResponseTests : TestBase { [TestMethod, ExpectedException(typeof(InvalidOperationException))] public void SendWithoutAspNetContext() { - new UserAgentResponse().Send(); + new OutgoingWebResponse().Send(); } [TestMethod] @@ -26,7 +26,7 @@ namespace DotNetOpenAuth.Test.Messaging { HttpContext context = new HttpContext(httpRequest, httpResponse); HttpContext.Current = context; - UserAgentResponse response = new UserAgentResponse(); + OutgoingWebResponse response = new OutgoingWebResponse(); response.Status = System.Net.HttpStatusCode.OK; response.Headers["someHeaderName"] = "someHeaderValue"; response.Body = "some body"; diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs index b5fc321..56fe8bc 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs @@ -167,12 +167,12 @@ namespace DotNetOpenAuth.Test.Mocks { return responseMessage; } - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { this.ProcessMessageFilter(response, true); - return new CoordinatingUserAgentResponse(response, this.RemoteChannel); + return new CoordinatingOutgoingWebResponse(response, this.RemoteChannel); } - protected override UserAgentResponse SendIndirectMessage(IDirectedProtocolMessage message) { + protected override OutgoingWebResponse SendIndirectMessage(IDirectedProtocolMessage message) { this.ProcessMessageFilter(message, true); // In this mock transport, direct and indirect messages are the same. return this.SendDirectMessageResponse(message); @@ -186,7 +186,7 @@ namespace DotNetOpenAuth.Test.Mocks { return request.Message; } - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { Channel_Accessor accessor = Channel_Accessor.AttachShadow(this.wrappedChannel); return accessor.ReadFromResponseCore(response); } diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs index a533815..6c32495 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs @@ -18,7 +18,7 @@ namespace DotNetOpenAuth.Test.Mocks { internal class CoordinatingOAuthChannel : OAuthChannel { private EventWaitHandle incomingMessageSignal = new AutoResetEvent(false); private IProtocolMessage incomingMessage; - private UserAgentResponse incomingRawResponse; + private OutgoingWebResponse incomingRawResponse; /// <summary> /// Initializes a new instance of the <see cref="CoordinatingOAuthChannel"/> class for Consumers. @@ -41,7 +41,7 @@ namespace DotNetOpenAuth.Test.Mocks { /// </summary> internal CoordinatingOAuthChannel RemoteChannel { get; set; } - internal UserAgentResponse RequestProtectedResource(AccessProtectedResourceRequest request) { + internal OutgoingWebResponse RequestProtectedResource(AccessProtectedResourceRequest request) { ((ITamperResistantOAuthMessage)request).HttpMethod = this.GetHttpMethod(((ITamperResistantOAuthMessage)request).HttpMethods); this.PrepareMessageForSending(request); HttpRequestInfo requestInfo = this.SpoofHttpMethod(request); @@ -52,7 +52,7 @@ namespace DotNetOpenAuth.Test.Mocks { return this.AwaitIncomingRawResponse(); } - internal void SendDirectRawResponse(UserAgentResponse response) { + internal void SendDirectRawResponse(OutgoingWebResponse response) { this.RemoteChannel.incomingRawResponse = response; this.RemoteChannel.incomingMessageSignal.Set(); } @@ -71,13 +71,13 @@ namespace DotNetOpenAuth.Test.Mocks { return this.AwaitIncomingMessage(); } - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { this.RemoteChannel.incomingMessage = CloneSerializedParts(response, null); this.RemoteChannel.incomingMessageSignal.Set(); return null; } - protected override UserAgentResponse SendIndirectMessage(IDirectedProtocolMessage message) { + protected override OutgoingWebResponse SendIndirectMessage(IDirectedProtocolMessage message) { // In this mock transport, direct and indirect messages are the same. return this.SendDirectMessageResponse(message); } @@ -114,9 +114,9 @@ namespace DotNetOpenAuth.Test.Mocks { return response; } - private UserAgentResponse AwaitIncomingRawResponse() { + private OutgoingWebResponse AwaitIncomingRawResponse() { this.incomingMessageSignal.WaitOne(); - UserAgentResponse response = this.incomingRawResponse; + OutgoingWebResponse response = this.incomingRawResponse; this.incomingRawResponse = null; return response; } diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs index 75c68e0..07f9bc9 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="CoordinatingUserAgentResponse.cs" company="Andrew Arnott"> +// <copyright file="CoordinatingOutgoingWebResponse.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -11,15 +11,15 @@ namespace DotNetOpenAuth.Test.Mocks { using System.Text; using DotNetOpenAuth.Messaging; - internal class CoordinatingUserAgentResponse : UserAgentResponse { + internal class CoordinatingOutgoingWebResponse : OutgoingWebResponse { private CoordinatingChannel receivingChannel; /// <summary> - /// Initializes a new instance of the <see cref="CoordinatingUserAgentResponse"/> class. + /// Initializes a new instance of the <see cref="CoordinatingOutgoingWebResponse"/> class. /// </summary> /// <param name="message">The direct response message to send to the remote channel. This message will be cloned.</param> /// <param name="receivingChannel">The receiving channel.</param> - internal CoordinatingUserAgentResponse(IProtocolMessage message, CoordinatingChannel receivingChannel) { + internal CoordinatingOutgoingWebResponse(IProtocolMessage message, CoordinatingChannel receivingChannel) { ErrorUtilities.VerifyArgumentNotNull(message, "message"); ErrorUtilities.VerifyArgumentNotNull(receivingChannel, "receivingChannel"); diff --git a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs index 75f78ad..51e966b 100644 --- a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs +++ b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs @@ -19,7 +19,7 @@ namespace DotNetOpenAuth.Test.Mocks { using DotNetOpenAuth.Yadis; internal class MockHttpRequest { - private readonly Dictionary<Uri, DirectWebResponse> registeredMockResponses = new Dictionary<Uri, DirectWebResponse>(); + private readonly Dictionary<Uri, IncomingWebResponse> registeredMockResponses = new Dictionary<Uri, IncomingWebResponse>(); private MockHttpRequest(IDirectWebRequestHandler mockHandler) { ErrorUtilities.VerifyArgumentNotNull(mockHandler, "mockHandler"); @@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.Mocks { return mock; } - internal void RegisterMockResponse(DirectWebResponse response) { + internal void RegisterMockResponse(IncomingWebResponse response) { ErrorUtilities.VerifyArgumentNotNull(response, "response"); if (this.registeredMockResponses.ContainsKey(response.RequestUri)) { Logger.WarnFormat("Mock HTTP response already registered for {0}.", response.RequestUri); @@ -172,7 +172,7 @@ namespace DotNetOpenAuth.Test.Mocks { var redirectionHeaders = new WebHeaderCollection { { HttpResponseHeader.Location, redirectLocation.AbsoluteUri }, }; - DirectWebResponse response = new CachedDirectWebResponse(origin, origin, redirectionHeaders, HttpStatusCode.Redirect, null, null, new MemoryStream()); + IncomingWebResponse response = new CachedDirectWebResponse(origin, origin, redirectionHeaders, HttpStatusCode.Redirect, null, null, new MemoryStream()); this.RegisterMockResponse(response); } @@ -188,8 +188,8 @@ namespace DotNetOpenAuth.Test.Mocks { this.RegisterMockResponse(errorResponse); } - private DirectWebResponse GetMockResponse(HttpWebRequest request) { - DirectWebResponse response; + private IncomingWebResponse GetMockResponse(HttpWebRequest request) { + IncomingWebResponse response; if (this.registeredMockResponses.TryGetValue(request.RequestUri, out response)) { // reset response stream position so this response can be reused on a subsequent request. response.ResponseStream.Seek(0, SeekOrigin.Begin); diff --git a/src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs b/src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs index 86108fb..c55d176 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs @@ -37,11 +37,11 @@ namespace DotNetOpenAuth.Test.Mocks { return base.ReadFromRequest(request); } - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { throw new NotImplementedException(); } - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { throw new NotImplementedException(); } } diff --git a/src/DotNetOpenAuth.Test/Mocks/TestChannel.cs b/src/DotNetOpenAuth.Test/Mocks/TestChannel.cs index a72ab63..3754f01 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestChannel.cs @@ -25,7 +25,7 @@ namespace DotNetOpenAuth.Test.Mocks { : base(messageTypeProvider, bindingElements) { } - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { throw new NotImplementedException("ReadFromResponseInternal"); } @@ -33,7 +33,7 @@ namespace DotNetOpenAuth.Test.Mocks { throw new NotImplementedException("CreateHttpRequest"); } - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { throw new NotImplementedException("SendDirectMessageResponse"); } } diff --git a/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs b/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs index 9ae87a5..b74c0f0 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs @@ -18,7 +18,7 @@ namespace DotNetOpenAuth.Test.Mocks { /// <summary> /// Gets or sets the callback used to provide the mock response for the mock request. /// </summary> - internal Func<HttpWebRequest, DirectWebResponse> Callback { get; set; } + internal Func<HttpWebRequest, IncomingWebResponse> Callback { get; set; } /// <summary> /// Gets the stream that was written out as if on an HTTP request. @@ -83,11 +83,11 @@ namespace DotNetOpenAuth.Test.Mocks { /// <returns> /// An instance of <see cref="Response"/> describing the response. /// </returns> - public DirectWebResponse GetResponse(HttpWebRequest request) { + public IncomingWebResponse GetResponse(HttpWebRequest request) { return this.GetResponse(request, DirectWebRequestOptions.None); } - public DirectWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options) { + public IncomingWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options) { if (this.Callback == null) { throw new InvalidOperationException("Set the Callback property first."); } @@ -104,7 +104,7 @@ namespace DotNetOpenAuth.Test.Mocks { return this.GetRequestStream(request); } - public DirectWebResponse GetResponse(HttpWebRequest request, bool requireSsl) { + public IncomingWebResponse GetResponse(HttpWebRequest request, bool requireSsl) { ErrorUtilities.VerifyProtocol(!requireSsl || request.RequestUri.Scheme == Uri.UriSchemeHttps, "disallowed request"); var result = this.GetResponse(request); ErrorUtilities.VerifyProtocol(!requireSsl || result.FinalUri.Scheme == Uri.UriSchemeHttps, "disallowed request"); diff --git a/src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs b/src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs index aaac447..c009a83 100644 --- a/src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs +++ b/src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs @@ -37,7 +37,7 @@ namespace DotNetOpenAuth.Test.OAuth { consumer.Channel.PrepareResponse(consumer.PrepareRequestUserAuthorization(new Uri("http://printer.example.com/request_token_ready"), null, null)); // .Send() dropped because this is just a simulation string accessToken = consumer.ProcessUserAuthorization().AccessToken; var photoRequest = consumer.CreateAuthorizingMessage(accessPhotoEndpoint, accessToken); - UserAgentResponse protectedPhoto = ((CoordinatingOAuthChannel)consumer.Channel).RequestProtectedResource(photoRequest); + OutgoingWebResponse protectedPhoto = ((CoordinatingOAuthChannel)consumer.Channel).RequestProtectedResource(photoRequest); Assert.IsNotNull(protectedPhoto); Assert.AreEqual(HttpStatusCode.OK, protectedPhoto.Status); Assert.AreEqual("image/jpeg", protectedPhoto.Headers[HttpResponseHeader.ContentType]); @@ -52,7 +52,7 @@ namespace DotNetOpenAuth.Test.OAuth { var accessRequest = sp.ReadAccessTokenRequest(); sp.Channel.PrepareResponse(sp.PrepareAccessTokenMessage(accessRequest)); // .Send() dropped because this is just a simulation string accessToken = sp.ReadProtectedResourceAuthorization().AccessToken; - ((CoordinatingOAuthChannel)sp.Channel).SendDirectRawResponse(new UserAgentResponse { + ((CoordinatingOAuthChannel)sp.Channel).SendDirectRawResponse(new OutgoingWebResponse { ResponseStream = new MemoryStream(new byte[] { 0x33, 0x66 }), Headers = new WebHeaderCollection { { HttpResponseHeader.ContentType, "image/jpeg" }, diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs index 7fd3476..143e9be 100644 --- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs +++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs @@ -87,7 +87,7 @@ namespace DotNetOpenAuth.Test.ChannelElements { Location = new Uri("http://hostb/pathB"), }; - UserAgentResponse response = this.channel.PrepareResponse(message); + OutgoingWebResponse response = this.channel.PrepareResponse(message); Assert.AreSame(message, response.OriginalMessage); Assert.AreEqual(HttpStatusCode.OK, response.Status); Assert.AreEqual(0, response.Headers.Count); @@ -160,7 +160,7 @@ namespace DotNetOpenAuth.Test.ChannelElements { [TestMethod] public void SendDirectMessageResponseHonorsHttpStatusCodes() { IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired); - UserAgentResponse directResponse = this.accessor.SendDirectMessageResponse(message); + OutgoingWebResponse directResponse = this.accessor.SendDirectMessageResponse(message); Assert.AreEqual(HttpStatusCode.OK, directResponse.Status); var httpMessage = new TestDirectResponseMessageWithHttpStatus(); diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs index 1355c54..a9c1924 100644 --- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs @@ -80,7 +80,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { byte[] expectedBytes = KeyValueFormEncoding.GetBytes(messageFields); string expectedContentType = OpenIdChannel_Accessor.KeyValueFormContentType; - UserAgentResponse directResponse = this.accessor.SendDirectMessageResponse(message); + OutgoingWebResponse directResponse = this.accessor.SendDirectMessageResponse(message); Assert.AreEqual(expectedContentType, directResponse.Headers[HttpResponseHeader.ContentType]); byte[] actualBytes = new byte[directResponse.ResponseStream.Length]; directResponse.ResponseStream.Read(actualBytes, 0, actualBytes.Length); @@ -108,7 +108,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { [TestMethod] public void SendDirectMessageResponseHonorsHttpStatusCodes() { IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired); - UserAgentResponse directResponse = this.accessor.SendDirectMessageResponse(message); + OutgoingWebResponse directResponse = this.accessor.SendDirectMessageResponse(message); Assert.AreEqual(HttpStatusCode.OK, directResponse.Status); var httpMessage = new TestDirectResponseMessageWithHttpStatus(); diff --git a/src/DotNetOpenAuth/DotNetOpenAuth.csproj b/src/DotNetOpenAuth/DotNetOpenAuth.csproj index 4452b54..61fbf1c 100644 --- a/src/DotNetOpenAuth/DotNetOpenAuth.csproj +++ b/src/DotNetOpenAuth/DotNetOpenAuth.csproj @@ -166,7 +166,7 @@ <Compile Include="Messaging\IHttpDirectResponse.cs" /> <Compile Include="Messaging\IExtensionMessage.cs" /> <Compile Include="Messaging\IMessage.cs" /> - <Compile Include="Messaging\DirectWebResponse.cs" /> + <Compile Include="Messaging\IncomingWebResponse.cs" /> <Compile Include="Messaging\IDirectResponseProtocolMessage.cs" /> <Compile Include="Messaging\EmptyDictionary.cs" /> <Compile Include="Messaging\EmptyEnumerator.cs" /> @@ -244,7 +244,7 @@ <Compile Include="Messaging\Reflection\MessagePart.cs" /> <Compile Include="Messaging\UnprotectedMessageException.cs" /> <Compile Include="OAuth\ChannelElements\OAuthChannel.cs" /> - <Compile Include="Messaging\UserAgentResponse.cs" /> + <Compile Include="Messaging\OutgoingWebResponse.cs" /> <Compile Include="Messaging\IProtocolMessage.cs" /> <Compile Include="Logger.cs" /> <Compile Include="Loggers\ILog.cs" /> diff --git a/src/DotNetOpenAuth/Messaging/CachedDirectWebResponse.cs b/src/DotNetOpenAuth/Messaging/CachedDirectWebResponse.cs index 4cf9639..b504555 100644 --- a/src/DotNetOpenAuth/Messaging/CachedDirectWebResponse.cs +++ b/src/DotNetOpenAuth/Messaging/CachedDirectWebResponse.cs @@ -16,7 +16,7 @@ namespace DotNetOpenAuth.Messaging { /// Cached details on the response from a direct web request to a remote party. /// </summary> [DebuggerDisplay("{Status} {ContentType.MediaType}, length: {ResponseStream.Length}")] - internal class CachedDirectWebResponse : DirectWebResponse { + internal class CachedDirectWebResponse : IncomingWebResponse { /// <summary> /// A seekable, repeatable response stream. /// </summary> diff --git a/src/DotNetOpenAuth/Messaging/Channel.cs b/src/DotNetOpenAuth/Messaging/Channel.cs index 6c44dc4..b9fdb0c 100644 --- a/src/DotNetOpenAuth/Messaging/Channel.cs +++ b/src/DotNetOpenAuth/Messaging/Channel.cs @@ -228,7 +228,7 @@ namespace DotNetOpenAuth.Messaging { /// </summary> /// <param name="message">The one-way message to send</param> /// <returns>The pending user agent redirect based message to be sent as an HttpResponse.</returns> - public UserAgentResponse PrepareResponse(IProtocolMessage message) { + public OutgoingWebResponse PrepareResponse(IProtocolMessage message) { Contract.Requires(message != null); ErrorUtilities.VerifyArgumentNotNull(message, "message"); @@ -472,7 +472,7 @@ namespace DotNetOpenAuth.Messaging { /// <param name="webRequest">The web request.</param> /// <returns>The response to the web request.</returns> /// <exception cref="ProtocolException">Thrown on network or protocol errors.</exception> - protected virtual DirectWebResponse GetDirectResponse(HttpWebRequest webRequest) { + protected virtual IncomingWebResponse GetDirectResponse(HttpWebRequest webRequest) { Contract.Requires(webRequest != null); ErrorUtilities.VerifyArgumentNotNull(webRequest, "webRequest"); return this.WebRequestHandler.GetResponse(webRequest); @@ -494,7 +494,7 @@ namespace DotNetOpenAuth.Messaging { IDictionary<string, string> responseFields; IDirectResponseProtocolMessage responseMessage; - using (DirectWebResponse response = this.GetDirectResponse(webRequest)) { + using (IncomingWebResponse response = this.GetDirectResponse(webRequest)) { if (response.ResponseStream == null) { return null; } @@ -520,7 +520,7 @@ namespace DotNetOpenAuth.Messaging { /// </summary> /// <param name="response">The HTTP direct response.</param> /// <param name="message">The newly instantiated message, prior to deserialization.</param> - protected virtual void OnReceivingDirectResponse(DirectWebResponse response, IDirectResponseProtocolMessage message) { + protected virtual void OnReceivingDirectResponse(IncomingWebResponse response, IDirectResponseProtocolMessage message) { } /// <summary> @@ -577,7 +577,7 @@ namespace DotNetOpenAuth.Messaging { /// </summary> /// <param name="message">The message to send.</param> /// <returns>The pending user agent redirect based message to be sent as an HttpResponse.</returns> - protected virtual UserAgentResponse SendIndirectMessage(IDirectedProtocolMessage message) { + protected virtual OutgoingWebResponse SendIndirectMessage(IDirectedProtocolMessage message) { Contract.Requires(message != null && message.Recipient != null); ErrorUtilities.VerifyArgumentNotNull(message, "message"); @@ -586,7 +586,7 @@ namespace DotNetOpenAuth.Messaging { // First try creating a 301 redirect, and fallback to a form POST // if the message is too big. - UserAgentResponse response = this.Create301RedirectResponse(message, fields); + OutgoingWebResponse response = this.Create301RedirectResponse(message, fields); if (response.Headers[HttpResponseHeader.Location].Length > IndirectMessageGetToPostThreshold) { response = this.CreateFormPostResponse(message, fields); } @@ -601,10 +601,10 @@ namespace DotNetOpenAuth.Messaging { /// <param name="message">The message to forward.</param> /// <param name="fields">The pre-serialized fields from the message.</param> /// <returns>The encoded HTTP response.</returns> - protected virtual UserAgentResponse Create301RedirectResponse(IDirectedProtocolMessage message, IDictionary<string, string> fields) { + protected virtual OutgoingWebResponse Create301RedirectResponse(IDirectedProtocolMessage message, IDictionary<string, string> fields) { Contract.Requires(message != null && message.Recipient != null); Contract.Requires(fields != null); - Contract.Ensures(Contract.Result<UserAgentResponse>() != null); + Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null); ErrorUtilities.VerifyArgumentNotNull(message, "message"); ErrorUtilities.VerifyArgumentNamed(message.Recipient != null, "message", MessagingStrings.DirectedMessageMissingRecipient); @@ -615,7 +615,7 @@ namespace DotNetOpenAuth.Messaging { MessagingUtilities.AppendQueryArgs(builder, fields); headers.Add(HttpResponseHeader.Location, builder.Uri.AbsoluteUri); Logger.DebugFormat("Redirecting to {0}", builder.Uri.AbsoluteUri); - UserAgentResponse response = new UserAgentResponse { + OutgoingWebResponse response = new OutgoingWebResponse { Status = HttpStatusCode.Redirect, Headers = headers, Body = null, @@ -632,10 +632,10 @@ namespace DotNetOpenAuth.Messaging { /// <param name="message">The message to forward.</param> /// <param name="fields">The pre-serialized fields from the message.</param> /// <returns>The encoded HTTP response.</returns> - protected virtual UserAgentResponse CreateFormPostResponse(IDirectedProtocolMessage message, IDictionary<string, string> fields) { + protected virtual OutgoingWebResponse CreateFormPostResponse(IDirectedProtocolMessage message, IDictionary<string, string> fields) { Contract.Requires(message != null && message.Recipient != null); Contract.Requires(fields != null); - Contract.Ensures(Contract.Result<UserAgentResponse>() != null); + Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null); ErrorUtilities.VerifyArgumentNotNull(message, "message"); ErrorUtilities.VerifyArgumentNamed(message.Recipient != null, "message", MessagingStrings.DirectedMessageMissingRecipient); ErrorUtilities.VerifyArgumentNotNull(fields, "fields"); @@ -654,7 +654,7 @@ namespace DotNetOpenAuth.Messaging { HttpUtility.HtmlEncode(message.Recipient.AbsoluteUri), hiddenFields); bodyWriter.Flush(); - UserAgentResponse response = new UserAgentResponse { + OutgoingWebResponse response = new OutgoingWebResponse { Status = HttpStatusCode.OK, Headers = headers, Body = bodyWriter.ToString(), @@ -670,7 +670,7 @@ namespace DotNetOpenAuth.Messaging { /// <param name="response">The response that is anticipated to contain an protocol message.</param> /// <returns>The deserialized message parts, if found. Null otherwise.</returns> /// <exception cref="ProtocolException">Thrown when the response is not valid.</exception> - protected abstract IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response); + protected abstract IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response); /// <summary> /// Prepares an HTTP request that carries a given message. @@ -696,7 +696,7 @@ namespace DotNetOpenAuth.Messaging { /// <remarks> /// This method implements spec V1.0 section 5.3. /// </remarks> - protected abstract UserAgentResponse SendDirectMessageResponse(IProtocolMessage response); + protected abstract OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response); /// <summary> /// Prepares a message for transmit by applying signatures, nonces, etc. diff --git a/src/DotNetOpenAuth/Messaging/ChannelContract.cs b/src/DotNetOpenAuth/Messaging/ChannelContract.cs index d5db0ad..8b45ce1 100644 --- a/src/DotNetOpenAuth/Messaging/ChannelContract.cs +++ b/src/DotNetOpenAuth/Messaging/ChannelContract.cs @@ -29,7 +29,7 @@ namespace DotNetOpenAuth.Messaging { /// The deserialized message parts, if found. Null otherwise. /// </returns> /// <exception cref="ProtocolException">Thrown when the response is not valid.</exception> - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { Contract.Requires(response != null); throw new NotImplementedException(); } @@ -45,9 +45,9 @@ namespace DotNetOpenAuth.Messaging { /// <remarks> /// This method implements spec V1.0 section 5.3. /// </remarks> - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { Contract.Requires(response != null); - Contract.Ensures(Contract.Result<UserAgentResponse>() != null); + Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null); throw new NotImplementedException(); } } diff --git a/src/DotNetOpenAuth/Messaging/IDirectWebRequestHandler.cs b/src/DotNetOpenAuth/Messaging/IDirectWebRequestHandler.cs index 00a9342..380e2d5 100644 --- a/src/DotNetOpenAuth/Messaging/IDirectWebRequestHandler.cs +++ b/src/DotNetOpenAuth/Messaging/IDirectWebRequestHandler.cs @@ -69,10 +69,10 @@ namespace DotNetOpenAuth.Messaging { /// <summary> /// Processes an <see cref="HttpWebRequest"/> and converts the - /// <see cref="HttpWebResponse"/> to a <see cref="DirectWebResponse"/> instance. + /// <see cref="HttpWebResponse"/> to a <see cref="IncomingWebResponse"/> instance. /// </summary> /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param> - /// <returns>An instance of <see cref="DirectWebResponse"/> describing the response.</returns> + /// <returns>An instance of <see cref="IncomingWebResponse"/> describing the response.</returns> /// <exception cref="ProtocolException">Thrown for any network error.</exception> /// <remarks> /// <para>Implementations should catch <see cref="WebException"/> and wrap it in a @@ -80,15 +80,15 @@ namespace DotNetOpenAuth.Messaging { /// a single exception type for hosts to catch. The <see cref="WebException.Response"/> /// value, if set, shoud be Closed before throwing.</para> /// </remarks> - DirectWebResponse GetResponse(HttpWebRequest request); + IncomingWebResponse GetResponse(HttpWebRequest request); /// <summary> /// Processes an <see cref="HttpWebRequest"/> and converts the - /// <see cref="HttpWebResponse"/> to a <see cref="DirectWebResponse"/> instance. + /// <see cref="HttpWebResponse"/> to a <see cref="IncomingWebResponse"/> instance. /// </summary> /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param> /// <param name="options">The options to apply to this web request.</param> - /// <returns>An instance of <see cref="DirectWebResponse"/> describing the response.</returns> + /// <returns>An instance of <see cref="IncomingWebResponse"/> describing the response.</returns> /// <exception cref="ProtocolException">Thrown for any network error.</exception> /// <remarks> /// <para>Implementations should catch <see cref="WebException"/> and wrap it in a @@ -96,6 +96,6 @@ namespace DotNetOpenAuth.Messaging { /// a single exception type for hosts to catch. The <see cref="WebException.Response"/> /// value, if set, shoud be Closed before throwing.</para> /// </remarks> - DirectWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options); + IncomingWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options); } } diff --git a/src/DotNetOpenAuth/Messaging/DirectWebResponse.cs b/src/DotNetOpenAuth/Messaging/IncomingWebResponse.cs index 11e1f75..5f4936d 100644 --- a/src/DotNetOpenAuth/Messaging/DirectWebResponse.cs +++ b/src/DotNetOpenAuth/Messaging/IncomingWebResponse.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="DirectWebResponse.cs" company="Andrew Arnott"> +// <copyright file="IncomingWebResponse.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -15,28 +15,28 @@ namespace DotNetOpenAuth.Messaging { using System.Text; /// <summary> - /// Details on the response from a direct web request to a remote party. + /// Details on the incoming response from a direct web request to a remote party. /// </summary> - public abstract class DirectWebResponse : IDisposable { + public abstract class IncomingWebResponse : IDisposable { /// <summary> /// The encoding to use in reading a response that does not declare its own content encoding. /// </summary> private const string DefaultContentEncoding = "ISO-8859-1"; /// <summary> - /// Initializes a new instance of the <see cref="DirectWebResponse"/> class. + /// Initializes a new instance of the <see cref="IncomingWebResponse"/> class. /// </summary> - protected internal DirectWebResponse() { + protected internal IncomingWebResponse() { this.Status = HttpStatusCode.OK; this.Headers = new WebHeaderCollection(); } /// <summary> - /// Initializes a new instance of the <see cref="DirectWebResponse"/> class. + /// Initializes a new instance of the <see cref="IncomingWebResponse"/> class. /// </summary> /// <param name="requestUri">The original request URI.</param> /// <param name="response">The response to initialize from. The network stream is used by this class directly.</param> - protected DirectWebResponse(Uri requestUri, HttpWebResponse response) { + protected IncomingWebResponse(Uri requestUri, HttpWebResponse response) { ErrorUtilities.VerifyArgumentNotNull(requestUri, "requestUri"); ErrorUtilities.VerifyArgumentNotNull(response, "response"); @@ -51,7 +51,7 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> - /// Initializes a new instance of the <see cref="DirectWebResponse"/> class. + /// Initializes a new instance of the <see cref="IncomingWebResponse"/> class. /// </summary> /// <param name="requestUri">The request URI.</param> /// <param name="responseUri">The final URI to respond to the request.</param> @@ -59,7 +59,7 @@ namespace DotNetOpenAuth.Messaging { /// <param name="statusCode">The status code.</param> /// <param name="contentType">Type of the content.</param> /// <param name="contentEncoding">The content encoding.</param> - protected DirectWebResponse(Uri requestUri, Uri responseUri, WebHeaderCollection headers, HttpStatusCode statusCode, string contentType, string contentEncoding) { + protected IncomingWebResponse(Uri requestUri, Uri responseUri, WebHeaderCollection headers, HttpStatusCode statusCode, string contentType, string contentEncoding) { ErrorUtilities.VerifyArgumentNotNull(requestUri, "requestUri"); this.RequestUri = requestUri; this.Status = statusCode; diff --git a/src/DotNetOpenAuth/Messaging/NetworkDirectWebResponse.cs b/src/DotNetOpenAuth/Messaging/NetworkDirectWebResponse.cs index d0618fa..2ee7feb 100644 --- a/src/DotNetOpenAuth/Messaging/NetworkDirectWebResponse.cs +++ b/src/DotNetOpenAuth/Messaging/NetworkDirectWebResponse.cs @@ -15,7 +15,7 @@ namespace DotNetOpenAuth.Messaging { /// A live network HTTP response /// </summary> [DebuggerDisplay("{Status} {ContentType.MediaType}")] - internal class NetworkDirectWebResponse : DirectWebResponse, IDisposable { + internal class NetworkDirectWebResponse : IncomingWebResponse, IDisposable { /// <summary> /// The network response object, used to initialize this instance, that still needs /// to be closed if applicable. diff --git a/src/DotNetOpenAuth/Messaging/UserAgentResponse.cs b/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs index 7343733..0112585 100644 --- a/src/DotNetOpenAuth/Messaging/UserAgentResponse.cs +++ b/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="UserAgentResponse.cs" company="Andrew Arnott"> +// <copyright file="OutgoingWebResponse.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -15,9 +15,9 @@ namespace DotNetOpenAuth.Messaging { using System.Web; /// <summary> - /// A protocol message (request or response) that passes between Consumer and Service Provider - /// via the user agent using a redirect or form POST submission, - /// OR a direct message response. + /// A protocol message (request or response) that passes from this + /// to a remote party via the user agent using a redirect or form + /// POST submission, OR a direct message response. /// </summary> /// <remarks> /// <para>An instance of this type describes the HTTP response that must be sent @@ -28,22 +28,22 @@ namespace DotNetOpenAuth.Messaging { /// can be canceled by calling <see cref="HttpResponse.End"/> after this message /// is sent on the response stream.</para> /// </remarks> - public class UserAgentResponse { + public class OutgoingWebResponse { /// <summary> - /// Initializes a new instance of the <see cref="UserAgentResponse"/> class. + /// Initializes a new instance of the <see cref="OutgoingWebResponse"/> class. /// </summary> - internal UserAgentResponse() { + internal OutgoingWebResponse() { this.Status = HttpStatusCode.OK; this.Headers = new WebHeaderCollection(); } /// <summary> - /// Initializes a new instance of the <see cref="UserAgentResponse"/> class + /// Initializes a new instance of the <see cref="OutgoingWebResponse"/> class /// based on the contents of an <see cref="HttpWebResponse"/>. /// </summary> /// <param name="response">The <see cref="HttpWebResponse"/> to clone.</param> /// <param name="maximumBytesToRead">The maximum bytes to read from the response stream.</param> - protected internal UserAgentResponse(HttpWebResponse response, int maximumBytesToRead) { + protected internal OutgoingWebResponse(HttpWebResponse response, int maximumBytesToRead) { ErrorUtilities.VerifyArgumentNotNull(response, "response"); this.Status = response.StatusCode; diff --git a/src/DotNetOpenAuth/Messaging/StandardWebRequestHandler.cs b/src/DotNetOpenAuth/Messaging/StandardWebRequestHandler.cs index 28b7d6b..b2594bd 100644 --- a/src/DotNetOpenAuth/Messaging/StandardWebRequestHandler.cs +++ b/src/DotNetOpenAuth/Messaging/StandardWebRequestHandler.cs @@ -84,11 +84,11 @@ namespace DotNetOpenAuth.Messaging { /// <summary> /// Processes an <see cref="HttpWebRequest"/> and converts the - /// <see cref="HttpWebResponse"/> to a <see cref="DirectWebResponse"/> instance. + /// <see cref="HttpWebResponse"/> to a <see cref="IncomingWebResponse"/> instance. /// </summary> /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param> /// <returns> - /// An instance of <see cref="DirectWebResponse"/> describing the response. + /// An instance of <see cref="IncomingWebResponse"/> describing the response. /// </returns> /// <exception cref="ProtocolException">Thrown for any network error.</exception> /// <remarks> @@ -97,18 +97,18 @@ namespace DotNetOpenAuth.Messaging { /// a single exception type for hosts to catch. The <see cref="WebException.Response"/> /// value, if set, shoud be Closed before throwing.</para> /// </remarks> - public DirectWebResponse GetResponse(HttpWebRequest request) { + public IncomingWebResponse GetResponse(HttpWebRequest request) { return this.GetResponse(request, DirectWebRequestOptions.None); } /// <summary> /// Processes an <see cref="HttpWebRequest"/> and converts the - /// <see cref="HttpWebResponse"/> to a <see cref="DirectWebResponse"/> instance. + /// <see cref="HttpWebResponse"/> to a <see cref="IncomingWebResponse"/> instance. /// </summary> /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param> /// <param name="options">The options to apply to this web request.</param> /// <returns> - /// An instance of <see cref="DirectWebResponse"/> describing the response. + /// An instance of <see cref="IncomingWebResponse"/> describing the response. /// </returns> /// <exception cref="ProtocolException">Thrown for any network error.</exception> /// <remarks> @@ -117,7 +117,7 @@ namespace DotNetOpenAuth.Messaging { /// a single exception type for hosts to catch. The <see cref="WebException.Response"/> /// value, if set, shoud be Closed before throwing.</para> /// </remarks> - public DirectWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options) { + public IncomingWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options) { ErrorUtilities.VerifyArgumentNotNull(request, "request"); ErrorUtilities.VerifySupported(this.CanSupport(options), MessagingStrings.DirectWebRequestOptionsNotSupported, options, this.GetType().Name); diff --git a/src/DotNetOpenAuth/Messaging/UntrustedWebRequestHandler.cs b/src/DotNetOpenAuth/Messaging/UntrustedWebRequestHandler.cs index 3913bae..7021b36 100644 --- a/src/DotNetOpenAuth/Messaging/UntrustedWebRequestHandler.cs +++ b/src/DotNetOpenAuth/Messaging/UntrustedWebRequestHandler.cs @@ -223,7 +223,7 @@ namespace DotNetOpenAuth.Messaging { /// <summary> /// Processes an <see cref="HttpWebRequest"/> and converts the - /// <see cref="HttpWebResponse"/> to a <see cref="DirectWebResponse"/> instance. + /// <see cref="HttpWebResponse"/> to a <see cref="IncomingWebResponse"/> instance. /// </summary> /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param> /// <param name="options">The options to apply to this web request.</param> @@ -238,7 +238,7 @@ namespace DotNetOpenAuth.Messaging { /// value, if set, shoud be Closed before throwing.</para> /// </remarks> [SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Uri(Uri, string) accepts second arguments that Uri(Uri, new Uri(string)) does not that we must support.")] - public DirectWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options) { + public IncomingWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options) { ErrorUtilities.VerifyArgumentNotNull(request, "request"); // This request MAY have already been prepared by GetRequestStream, but @@ -284,11 +284,11 @@ namespace DotNetOpenAuth.Messaging { /// <summary> /// Processes an <see cref="HttpWebRequest"/> and converts the - /// <see cref="HttpWebResponse"/> to a <see cref="DirectWebResponse"/> instance. + /// <see cref="HttpWebResponse"/> to a <see cref="IncomingWebResponse"/> instance. /// </summary> /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param> /// <returns> - /// An instance of <see cref="DirectWebResponse"/> describing the response. + /// An instance of <see cref="IncomingWebResponse"/> describing the response. /// </returns> /// <exception cref="ProtocolException">Thrown for any network error.</exception> /// <remarks> @@ -297,7 +297,7 @@ namespace DotNetOpenAuth.Messaging { /// a single exception type for hosts to catch. The <see cref="WebException.Response"/> /// value, if set, shoud be Closed before throwing.</para> /// </remarks> - DirectWebResponse IDirectWebRequestHandler.GetResponse(HttpWebRequest request) { + IncomingWebResponse IDirectWebRequestHandler.GetResponse(HttpWebRequest request) { return this.GetResponse(request, DirectWebRequestOptions.None); } diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs index b30988c..f91b1b0 100644 --- a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs +++ b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs @@ -152,7 +152,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { /// <returns> /// The deserialized message parts, if found. Null otherwise. /// </returns> - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { ErrorUtilities.VerifyArgumentNotNull(response, "response"); string body = response.GetResponseReader().ReadToEnd(); @@ -197,14 +197,14 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { /// <remarks> /// This method implements spec V1.0 section 5.3. /// </remarks> - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { ErrorUtilities.VerifyArgumentNotNull(response, "response"); var messageAccessor = this.MessageDescriptions.GetAccessor(response); var fields = messageAccessor.Serialize(); string responseBody = MessagingUtilities.CreateQueryString(fields); - UserAgentResponse encodedResponse = new UserAgentResponse { + OutgoingWebResponse encodedResponse = new OutgoingWebResponse { Body = responseBody, OriginalMessage = response, Status = HttpStatusCode.OK, diff --git a/src/DotNetOpenAuth/OAuth/ConsumerBase.cs b/src/DotNetOpenAuth/OAuth/ConsumerBase.cs index b24685e..b76daaa 100644 --- a/src/DotNetOpenAuth/OAuth/ConsumerBase.cs +++ b/src/DotNetOpenAuth/OAuth/ConsumerBase.cs @@ -87,7 +87,7 @@ namespace DotNetOpenAuth.OAuth { /// <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 DirectWebResponse PrepareAuthorizedRequestAndSend(MessageReceivingEndpoint endpoint, string accessToken) { + public IncomingWebResponse PrepareAuthorizedRequestAndSend(MessageReceivingEndpoint endpoint, string accessToken) { IDirectedProtocolMessage message = this.CreateAuthorizingMessage(endpoint, accessToken); HttpWebRequest wr = this.OAuthChannel.InitializeRequest(message); return this.Channel.WebRequestHandler.GetResponse(wr); diff --git a/src/DotNetOpenAuth/OAuth/DesktopConsumer.cs b/src/DotNetOpenAuth/OAuth/DesktopConsumer.cs index 23d367c..c422ab0 100644 --- a/src/DotNetOpenAuth/OAuth/DesktopConsumer.cs +++ b/src/DotNetOpenAuth/OAuth/DesktopConsumer.cs @@ -40,7 +40,7 @@ namespace DotNetOpenAuth.OAuth { [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "2#", Justification = "Two results")] public Uri RequestUserAuthorization(IDictionary<string, string> requestParameters, IDictionary<string, string> redirectParameters, out string requestToken) { var message = this.PrepareRequestUserAuthorization(null, requestParameters, redirectParameters, out requestToken); - UserAgentResponse response = this.Channel.PrepareResponse(message); + OutgoingWebResponse response = this.Channel.PrepareResponse(message); return response.GetDirectUriRequest(this.Channel); } diff --git a/src/DotNetOpenAuth/OpenId/ChannelElements/OpenIdChannel.cs b/src/DotNetOpenAuth/OpenId/ChannelElements/OpenIdChannel.cs index c82462c..75bc4e4 100644 --- a/src/DotNetOpenAuth/OpenId/ChannelElements/OpenIdChannel.cs +++ b/src/DotNetOpenAuth/OpenId/ChannelElements/OpenIdChannel.cs @@ -186,7 +186,7 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { /// The deserialized message parts, if found. Null otherwise. /// </returns> /// <exception cref="ProtocolException">Thrown when the response is not valid.</exception> - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { if (response == null) { throw new ArgumentNullException("response"); } @@ -203,7 +203,7 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { /// </summary> /// <param name="response">The HTTP direct response.</param> /// <param name="message">The newly instantiated message, prior to deserialization.</param> - protected override void OnReceivingDirectResponse(DirectWebResponse response, IDirectResponseProtocolMessage message) { + protected override void OnReceivingDirectResponse(IncomingWebResponse response, IDirectResponseProtocolMessage message) { base.OnReceivingDirectResponse(response, message); // Verify that the expected HTTP status code was used for the message, @@ -232,14 +232,14 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { /// <remarks> /// This method implements spec V1.0 section 5.3. /// </remarks> - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { ErrorUtilities.VerifyArgumentNotNull(response, "response"); var messageAccessor = this.MessageDescriptions.GetAccessor(response); var fields = messageAccessor.Serialize(); byte[] keyValueEncoding = KeyValueFormEncoding.GetBytes(fields); - UserAgentResponse preparedResponse = new UserAgentResponse(); + OutgoingWebResponse preparedResponse = new OutgoingWebResponse(); preparedResponse.Headers.Add(HttpResponseHeader.ContentType, KeyValueFormContentType); preparedResponse.OriginalMessage = response; preparedResponse.ResponseStream = new MemoryStream(keyValueEncoding); @@ -258,8 +258,8 @@ namespace DotNetOpenAuth.OpenId.ChannelElements { /// <param name="webRequest">The web request.</param> /// <returns>The response to the web request.</returns> /// <exception cref="ProtocolException">Thrown on network or protocol errors.</exception> - protected override DirectWebResponse GetDirectResponse(HttpWebRequest webRequest) { - DirectWebResponse response = this.WebRequestHandler.GetResponse(webRequest, DirectWebRequestOptions.AcceptAllHttpResponses); + protected override IncomingWebResponse GetDirectResponse(HttpWebRequest webRequest) { + IncomingWebResponse response = this.WebRequestHandler.GetResponse(webRequest, DirectWebRequestOptions.AcceptAllHttpResponses); // Filter the responses to the allowable set of HTTP status codes. if (response.Status != HttpStatusCode.OK && response.Status != HttpStatusCode.BadRequest) { diff --git a/src/DotNetOpenAuth/OpenId/Provider/OpenIdProvider.cs b/src/DotNetOpenAuth/OpenId/Provider/OpenIdProvider.cs index 513e364..3d7e804 100644 --- a/src/DotNetOpenAuth/OpenId/Provider/OpenIdProvider.cs +++ b/src/DotNetOpenAuth/OpenId/Provider/OpenIdProvider.cs @@ -224,7 +224,7 @@ namespace DotNetOpenAuth.OpenId.Provider { /// <exception cref="ThreadAbortException">Thrown by ASP.NET in order to prevent additional data from the page being sent to the client and corrupting the response.</exception> /// <remarks> /// <para>Requires an HttpContext.Current context. If one is not available, the caller should use - /// <see cref="GetResponse"/> instead and manually send the <see cref="UserAgentResponse"/> + /// <see cref="GetResponse"/> instead and manually send the <see cref="OutgoingWebResponse"/> /// to the client.</para> /// </remarks> /// <exception cref="InvalidOperationException">Thrown if <see cref="IRequest.IsResponseReady"/> is <c>false</c>.</exception> @@ -245,7 +245,7 @@ namespace DotNetOpenAuth.OpenId.Provider { /// <returns>The response that should be sent to the client.</returns> /// <exception cref="InvalidOperationException">Thrown if <see cref="IRequest.IsResponseReady"/> is <c>false</c>.</exception> [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "Code Contract requires that we cast early.")] - public UserAgentResponse GetResponse(IRequest request) { + public OutgoingWebResponse GetResponse(IRequest request) { Contract.Requires(request != null); Contract.Requires(((Request)request).IsResponseReady); ErrorUtilities.VerifyArgumentNotNull(request, "request"); @@ -270,10 +270,10 @@ namespace DotNetOpenAuth.OpenId.Provider { /// be the same as <paramref name="claimedIdentifier"/>.</param> /// <param name="extensions">The extensions.</param> /// <returns> - /// A <see cref="UserAgentResponse"/> object describing the HTTP response to send + /// A <see cref="OutgoingWebResponse"/> object describing the HTTP response to send /// the user agent to allow the redirect with assertion to happen. /// </returns> - public UserAgentResponse PrepareUnsolicitedAssertion(Uri providerEndpoint, Realm relyingParty, Identifier claimedIdentifier, Identifier localIdentifier, params IExtensionMessage[] extensions) { + public OutgoingWebResponse PrepareUnsolicitedAssertion(Uri providerEndpoint, Realm relyingParty, Identifier claimedIdentifier, Identifier localIdentifier, params IExtensionMessage[] extensions) { Contract.Requires(providerEndpoint != null); Contract.Requires(providerEndpoint.IsAbsoluteUri); Contract.Requires(relyingParty != null); diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs index c488401..5a28fad 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs @@ -88,7 +88,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// to redirect it to the OpenID Provider to start the OpenID authentication process. /// </summary> /// <value></value> - public UserAgentResponse RedirectingResponse { + public OutgoingWebResponse RedirectingResponse { get { return this.RelyingParty.Channel.PrepareResponse(this.CreateRequestMessage()); } } diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/IAuthenticationRequest.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/IAuthenticationRequest.cs index a04fb71..00f9d22 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/IAuthenticationRequest.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/IAuthenticationRequest.cs @@ -26,7 +26,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// Gets the HTTP response the relying party should send to the user agent /// to redirect it to the OpenID Provider to start the OpenID authentication process. /// </summary> - UserAgentResponse RedirectingResponse { get; } + OutgoingWebResponse RedirectingResponse { get; } /// <summary> /// Gets the URL that the user agent will return to after authentication diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs index 6b732ae..896c88b 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs @@ -912,7 +912,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { discoveryResultBuilder.Append("{"); discoveryResultBuilder.AppendFormat("endpoint: {0},", MessagingUtilities.GetSafeJavascriptValue(request.Provider.Uri.AbsoluteUri)); request.Mode = AuthenticationRequestMode.Immediate; - UserAgentResponse response = request.RedirectingResponse; + OutgoingWebResponse response = request.RedirectingResponse; discoveryResultBuilder.AppendFormat("immediate: {0},", MessagingUtilities.GetSafeJavascriptValue(response.GetDirectUriRequest(this.RelyingParty.Channel).AbsoluteUri)); request.Mode = AuthenticationRequestMode.Setup; response = request.RedirectingResponse; diff --git a/src/DotNetOpenAuth/Yadis/Yadis.cs b/src/DotNetOpenAuth/Yadis/Yadis.cs index b7d1482..84443e4 100644 --- a/src/DotNetOpenAuth/Yadis/Yadis.cs +++ b/src/DotNetOpenAuth/Yadis/Yadis.cs @@ -126,7 +126,7 @@ namespace DotNetOpenAuth.Yadis { /// <param name="requireSsl">Whether only HTTPS URLs should ever be retrieved.</param> /// <param name="acceptTypes">The value of the Accept HTTP header to include in the request.</param> /// <returns>The HTTP response retrieved from the request.</returns> - internal static DirectWebResponse Request(IDirectWebRequestHandler requestHandler, Uri uri, bool requireSsl, params string[] acceptTypes) { + internal static IncomingWebResponse Request(IDirectWebRequestHandler requestHandler, Uri uri, bool requireSsl, params string[] acceptTypes) { ErrorUtilities.VerifyArgumentNotNull(requestHandler, "requestHandler"); ErrorUtilities.VerifyArgumentNotNull(uri, "uri"); |