summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-03-21 22:58:36 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2012-03-21 22:58:36 -0700
commit80028b1c5442c85909b889b3c52cfbd0c0121437 (patch)
treeb1b651c08a349957bb3d26ad5234a266d8d3e42e /src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
parentf02ccf1e93367b7ab8bece3a2c53e960e98d221d (diff)
parente1455ee979b150d1ea4afdf1bc82a9e5cbc5b2ba (diff)
downloadDotNetOpenAuth-80028b1c5442c85909b889b3c52cfbd0c0121437.zip
DotNetOpenAuth-80028b1c5442c85909b889b3c52cfbd0c0121437.tar.gz
DotNetOpenAuth-80028b1c5442c85909b889b3c52cfbd0c0121437.tar.bz2
Merge branch 'v4.0' into dev11
Conflicts: src/DotNetOpenAuth.sln
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs')
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
index 1c2a080..947c044 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
@@ -48,7 +48,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// <returns>
/// The deserialized message, if one is found. Null otherwise.
/// </returns>
- protected override IDirectedProtocolMessage ReadFromRequestCore(HttpRequestInfo request) {
+ protected override IDirectedProtocolMessage ReadFromRequestCore(HttpRequestBase request) {
var fields = new Dictionary<string, string>();
string accessToken;
if ((accessToken = SearchForBearerAccessTokenInRequest(request)) != null) {
@@ -106,7 +106,7 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
ErrorUtilities.VerifyInternal(unauthorizedResponse != null, "Only unauthorized responses are expected.");
// First initialize based on the specifics within the message.
- this.ApplyMessageTemplate(response, webResponse);
+ ApplyMessageTemplate(response, webResponse);
if (!(response is IHttpDirectResponse)) {
webResponse.Status = HttpStatusCode.Unauthorized;
}
@@ -122,18 +122,18 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// </summary>
/// <param name="request">The request.</param>
/// <returns>The bearer access token, if one exists. Otherwise <c>null</c>.</returns>
- private static string SearchForBearerAccessTokenInRequest(HttpRequestInfo request) {
+ private static string SearchForBearerAccessTokenInRequest(HttpRequestBase request) {
Requires.NotNull(request, "request");
// First search the authorization header.
- string authorizationHeader = request.Headers[HttpRequestHeader.Authorization];
+ string authorizationHeader = request.Headers[HttpRequestHeaders.Authorization];
if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith(Protocol.BearerHttpAuthorizationSchemeWithTrailingSpace, StringComparison.OrdinalIgnoreCase)) {
return authorizationHeader.Substring(Protocol.BearerHttpAuthorizationSchemeWithTrailingSpace.Length);
}
// Failing that, scan the entity
- if (!string.IsNullOrEmpty(request.Headers[HttpRequestHeader.ContentType])) {
- var contentType = new ContentType(request.Headers[HttpRequestHeader.ContentType]);
+ if (!string.IsNullOrEmpty(request.Headers[HttpRequestHeaders.ContentType])) {
+ var contentType = new ContentType(request.Headers[HttpRequestHeaders.ContentType]);
if (string.Equals(contentType.MediaType, HttpFormUrlEncoded, StringComparison.Ordinal)) {
if (request.Form[Protocol.BearerTokenEncodedUrlParameterName] != null) {
return request.Form[Protocol.BearerTokenEncodedUrlParameterName];
@@ -142,8 +142,9 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
}
// Finally, check the least desirable location: the query string
- if (!String.IsNullOrEmpty(request.QueryStringBeforeRewriting[Protocol.BearerTokenEncodedUrlParameterName])) {
- return request.QueryStringBeforeRewriting[Protocol.BearerTokenEncodedUrlParameterName];
+ var unrewrittenQuery = request.GetQueryStringBeforeRewriting();
+ if (!string.IsNullOrEmpty(unrewrittenQuery[Protocol.BearerTokenEncodedUrlParameterName])) {
+ return unrewrittenQuery[Protocol.BearerTokenEncodedUrlParameterName];
}
return null;