--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/7pbFsPI1c1AJ.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.
// TODO FIXME dnoa doesn't support HttpRequestMessage - manually creating HttpRequestMessageProperty until they dovar request = new HttpRequestMessageProperty();request.Headers[HttpRequestHeader.Authorization] = actionContext.Request.Headers.Authorization.ToString();var requestUri = actionContext.Request.RequestUri;
Wait, where did you take that from?Anyways; this is basically what you need: https://github.com/DavidChristiansen/DotNetOpenAuth.WebAPI.40/blob/master/source/DotNetOpenAuth.WebAPI/AuthenticationConfiguration.cs (plus referenced classes, there are 2 or thee more you need to get it working).
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/7DAx-m6gd34J.
The problem is that the ResourceServer class, which is used for validating the request, takes in an HttpRequestMessageBase.
WebApi, through filters (which is where you would put authentication for requests) exposes only an HttpRequest object, not an HttpRequestMessage or an HttpRequestMessageBase
I'm talking about code, from the resource server example in oauth2, the class is the AuthenticationManager class or something like that. It's the only class with the word manager in it :P
Andrew: The main problem is that the method for validating the request does not take in an HttpRequest. It only accepts HttpRequestMessageBase and HttpRequestMessageProperty
I'm doing something of the same (by the way, I have OAuth2 resource server working seamingly perfectly with web api, I'll share the code when it's a bit less coupled to the tests I'm currently running). I used the sources found https://github.com/DavidChristiansen/DotNetOpenAuth.WebAPI.40 here. He uses an even dirtier trick though. He just wraps HttpContext.Current.Request in a HttpRequestBaseWrapper (or whatever it's called), but it works, and for now get's the job done.
That works as is with the code. I use a DelegatingHandler and I still use [Authorize(Roles="users")] no problem (the scopes are treated as roles).
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/kanPdJ_S0WcJ.
I think you've misunderstood something (or I have). The problem is that there is introduced a new Request-class in Web API named System.Net.Http.HttpRequestMessage. It has (next to) nothing in common with the regular HttpRequest. For instance, as far as I can tell, HttpRequestMessage does not parse form-data, and almost all of the methods exposed on the object is async only.
Oh, and as a side-node; I do not think HttpRequestWrapper is a dirty trick; I think using the ThreadStatic property HttpContext.Current is. Also, using ThreadStatic properties in an async method makes my hair tingle, and not in a good way...
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/NYYAzusuNUMJ.
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/O4SOJ8l8ruAJ.
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/Nzqildq4yzcJ.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.
Hi Aleksander.
Is this two or three legged implementation OAuth2 ResourceServer with WebApi ?
I am looking for three legged implementation...
Thanks
On Saturday, 28 July 2012 11:24:14 UTC-7, Aleksander Heintz wrote:So, eh, yeah... Have fun: https://gist.github.com/3194281
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/gH36iDPrsf4J.
Hi,I was able to retrieve HttpRequestBase from HttpRequestMessage by using the method described in the following blog:[How to access HTTPContext from within your Web API action]Basically, you get a HttpContext from HttpRequest.Properties.TryGetValue("MS_HttpContext"). Once you get the HttpContext, you can get HttpRequestBase using HttpContext.Request.
On Saturday, July 28, 2012 8:02:33 AM UTC-7, Aleksander Heintz wrote:I think you've misunderstood something (or I have). The problem is that there is introduced a new Request-class in Web API named System.Net.Http.HttpRequestMessage. It has (next to) nothing in common with the regular HttpRequest. For instance, as far as I can tell, HttpRequestMessage does not parse form-data, and almost all of the methods exposed on the object is async only.
Oh, and as a side-node; I do not think HttpRequestWrapper is a dirty trick; I think using the ThreadStatic property HttpContext.Current is. Also, using ThreadStatic properties in an async method makes my hair tingle, and not in a good way...
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/xm3uViyCG7QJ.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.