diff options
6 files changed, 26 insertions, 10 deletions
diff --git a/projecttemplates/MvcRelyingParty/Controllers/AuthController.cs b/projecttemplates/MvcRelyingParty/Controllers/AuthController.cs index 446c6ac..3089b89 100644 --- a/projecttemplates/MvcRelyingParty/Controllers/AuthController.cs +++ b/projecttemplates/MvcRelyingParty/Controllers/AuthController.cs @@ -123,7 +123,7 @@ namespace MvcRelyingParty.Controllers { if (!string.IsNullOrEmpty(openid_openidAuthData)) { // Always say it's a GET since the payload is all in the URL, even the large ones. var auth = new Uri(openid_openidAuthData); - HttpRequestBase clientResponseInfo = new HttpRequestInfo("GET", auth, headers: Request.Headers); + HttpRequestBase clientResponseInfo = HttpRequestInfo.Create("GET", auth, headers: Request.Headers); response = this.RelyingParty.GetResponse(clientResponseInfo); } else { response = this.RelyingParty.GetResponse(); @@ -165,7 +165,7 @@ namespace MvcRelyingParty.Controllers { } // Always say it's a GET since the payload is all in the URL, even the large ones. - HttpRequestBase clientResponseInfo = new HttpRequestInfo("GET", auth, headers: headers); + HttpRequestBase clientResponseInfo = HttpRequestInfo.Create("GET", auth, headers: headers); response = this.RelyingParty.GetResponse(clientResponseInfo); } else { response = this.RelyingParty.GetResponse(); diff --git a/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs b/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs index 6dc5b7d..8d0c13d 100644 --- a/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs +++ b/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs @@ -69,7 +69,7 @@ var resourceServer = new ResourceServer(new StandardAccessTokenAnalyzer(signing, encrypting)); IPrincipal result; - var error = resourceServer.VerifyAccess(new HttpRequestInfo(httpDetails, requestUri), out result); + var error = resourceServer.VerifyAccess(HttpRequestInfo.Create(httpDetails, requestUri), out result); // TODO: return the prepared error code. return error != null ? null : result; diff --git a/samples/OpenIdOfflineProvider/HostedProvider.cs b/samples/OpenIdOfflineProvider/HostedProvider.cs index 788817d..0f10ba1 100644 --- a/samples/OpenIdOfflineProvider/HostedProvider.cs +++ b/samples/OpenIdOfflineProvider/HostedProvider.cs @@ -227,7 +227,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { Uri providerEndpoint = providerEndpointBuilder.Uri; if (context.Request.Url.AbsolutePath == ProviderPath) { - HttpRequestBase requestInfo = new HttpRequestInfo(context.Request); + HttpRequestBase requestInfo = HttpRequestInfo.Create(context.Request); this.ProcessRequest(requestInfo, context.Response); } else if (context.Request.Url.AbsolutePath.StartsWith(UserIdentifierPath, StringComparison.Ordinal)) { using (StreamWriter sw = new StreamWriter(outputStream)) { diff --git a/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs b/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs index 24ca616..fc86728 100644 --- a/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs +++ b/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs @@ -38,7 +38,7 @@ namespace DotNetOpenAuth.Messaging { private readonly NameValueCollection serverVariables; - public HttpRequestInfo(HttpRequestMessageProperty request, Uri requestUri) { + internal HttpRequestInfo(HttpRequestMessageProperty request, Uri requestUri) { Requires.NotNull(request, "request"); Requires.NotNull(requestUri, "requestUri"); @@ -51,7 +51,7 @@ namespace DotNetOpenAuth.Messaging { Reporting.RecordRequestStatistics(this); } - public HttpRequestInfo(string httpMethod, Uri requestUri, NameValueCollection form = null, NameValueCollection headers = null) { + internal HttpRequestInfo(string httpMethod, Uri requestUri, NameValueCollection form = null, NameValueCollection headers = null) { Requires.NotNullOrEmpty(httpMethod, "httpMethod"); Requires.NotNull(requestUri, "requestUri"); @@ -67,7 +67,7 @@ namespace DotNetOpenAuth.Messaging { /// Initializes a new instance of the <see cref="HttpRequestInfo"/> class. /// </summary> /// <param name="listenerRequest">Details on the incoming HTTP request.</param> - public HttpRequestInfo(HttpListenerRequest listenerRequest) { + internal HttpRequestInfo(HttpListenerRequest listenerRequest) { Requires.NotNull(listenerRequest, "listenerRequest"); this.httpMethod = listenerRequest.HttpMethod; @@ -80,7 +80,7 @@ namespace DotNetOpenAuth.Messaging { Reporting.RecordRequestStatistics(this); } - public HttpRequestInfo(string httpMethod, Uri requestUri, NameValueCollection headers, Stream inputStream) { + internal HttpRequestInfo(string httpMethod, Uri requestUri, NameValueCollection headers, Stream inputStream) { Requires.NotNullOrEmpty(httpMethod, "httpMethod"); Requires.NotNull(requestUri, "requestUri"); @@ -122,6 +122,22 @@ namespace DotNetOpenAuth.Messaging { get { return this.serverVariables; } } + public static HttpRequestBase Create(HttpRequestMessageProperty request, Uri requestUri) { + return new HttpRequestInfo(request, requestUri); + } + + public static HttpRequestBase Create(HttpListenerRequest listenerRequest) { + return new HttpRequestInfo(listenerRequest); + } + + public static HttpRequestBase Create(string httpMethod, Uri requestUri, NameValueCollection form = null, NameValueCollection headers = null) { + return new HttpRequestInfo(httpMethod, requestUri, form, headers); + } + + public static HttpRequestBase Create(string httpMethod, Uri requestUri, NameValueCollection headers, Stream inputStream) { + return new HttpRequestInfo(httpMethod, requestUri, headers, inputStream); + } + private static NameValueCollection ParseFormData(string httpMethod, NameValueCollection headers, Stream inputStream) { Requires.NotNullOrEmpty(httpMethod, "httpMethod"); Requires.NotNull(headers, "headers"); diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Association.cs b/src/DotNetOpenAuth.OpenId/OpenId/Association.cs index 700b24e..764f4fa 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/Association.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/Association.cs @@ -222,7 +222,7 @@ namespace DotNetOpenAuth.OpenId { if (a.Handle != this.Handle || a.Issued != this.Issued || - !MessagingUtilities.Equals(a.TotalLifeLength, this.TotalLifeLength, TimeSpan.FromSeconds(1))) { + !MessagingUtilities.Equals(a.TotalLifeLength, this.TotalLifeLength, TimeSpan.FromSeconds(2))) { return false; } diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs index 1917ce6..0bbf756 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs @@ -69,7 +69,7 @@ namespace DotNetOpenAuth.Test.Mocks { internal IDirectedProtocolMessage Message { get { if (this.message == null && this.messageData != null) { - var message = messageFactory.GetNewRequestMessage(recipient, this.messageData); + var message = this.messageFactory.GetNewRequestMessage(recipient, this.messageData); if (message != null) { this.channel.MessageDescriptions.GetAccessor(message).Deserialize(this.messageData); this.message = message; |