Hi folks!Just getting started with DNOA and trying to implement a very simple OAuth2 Authorization server for an API using the Resource Owner Password Flow (client app asks the resource owner to enter credentials and passes them to an Authorize request along with the client ID and client secret). I've been looking at a bit of the sample code, but it's not clear to me what the basic steps are to implement an Authorization server -- if indeed that is what I need -- and how to translate some of the OAuth2 workflows into working code using the library. Can someone point me to something like an overview that might help me to understand the workflow of a DotNetOpenAuth implementation? I have the RFC and a starter book on OAuth2, but the terminology in those docs vs. the sample code and help file are not consistent.Also, I have managed to get a basic MVC controller working that will receive a form-urlencoded set of credentials from a Fiddler client. My request looks like:POST http://localhost:61732/OAuth2/Authorize HTTP/1.1User-Agent: FiddlerHost: localhost:61732Accept: application/jsonContent-Type: application/x-www-form-urlencodedContent-Length: 72grant_type=password&client_id=Canon&username=rmiller&password=4GETmeknotWhen the action method on the server calls ReadAuthorizationRequest(), I am getting the exception "This message can only be sent over HTTPS." I read in another post that setting an attribute on the messaging section in web.config called relaxSslRequirements to true would solve that, but it has had no effect, and I cannot find any documentation of the config parameters and what they mean.Thanks, everyone!Rich--
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/-/YjqNsMU8-oYJ.
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.
To unsubscribe from this group, send email to dotnetopenid+unsubscribe@googlegroups.com.
The OAuthAuthorizationServer and OAuthResourceServer samples that you can get from http://sourceforge.net/projects/dnoa/files/latest/ should outline how to build the server(s). They don't demonstrate a resource owner password grant but that should hopefully be a straightforward addition.It appears that you're sending the user credentials to the authorization endpoint, which is incorrect. You should send these to the token endpoint instead.
As for the HTTPS requirement, DNOA should be honoring the web.config setting but maybe that bit is buggy. Can you include your web.config file so I can check it for accuracy? (be sure to scrub it of any confidential data)
--
Andrew Arnott
"I [may] not agree with what you have to say, but I'll defend to the death your right to say it." - S. G. Tallentyre
On Tue, Jul 24, 2012 at 2:47 PM, Rich Miller <richmi...@gmail.com> wrote:
Hi folks!Just getting started with DNOA and trying to implement a very simple OAuth2 Authorization server for an API using the Resource Owner Password Flow (client app asks the resource owner to enter credentials and passes them to an Authorize request along with the client ID and client secret). I've been looking at a bit of the sample code, but it's not clear to me what the basic steps are to implement an Authorization server -- if indeed that is what I need -- and how to translate some of the OAuth2 workflows into working code using the library. Can someone point me to something like an overview that might help me to understand the workflow of a DotNetOpenAuth implementation? I have the RFC and a starter book on OAuth2, but the terminology in those docs vs. the sample code and help file are not consistent.Also, I have managed to get a basic MVC controller working that will receive a form-urlencoded set of credentials from a Fiddler client. My request looks like:
POST http://localhost:61732/OAuth2/Authorize HTTP/1.1User-Agent: FiddlerHost: localhost:61732Accept: application/jsonContent-Type: application/x-www-form-urlencodedContent-Length: 72
grant_type=password&client_id=Canon&username=rmiller&password=xxxxx
When the action method on the server calls ReadAuthorizationRequest(), I am getting the exception "This message can only be sent over HTTPS." I read in another post that setting an attribute on the messaging section in web.config called relaxSslRequirements to true would solve that, but it has had no effect, and I cannot find any documentation of the config parameters and what they mean.Thanks, everyone!
Rich--
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/-/YjqNsMU8-oYJ.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/0krNIbyg4ekJ.
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.
Andrew,Thanks for the response. I'll admit to being really new to all of this -- both OAuth2 and DNOA -- and I guess one thing that has me a bit confused at this point regarding DNOA. Could you explain in general terms what the role of each of the server types is?
Is the use of the Authorization server appropriate and the name of the endpoint wrong?
What function does a Resource Server perform?
If the client has received an access token from the Authorization server, wouldn't I simply need to validate the token when the client requested a resource from my API?
--
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/-/Hk_IqNSbKg8J.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
--
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/-/bg7tEadb0IwJ.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid+unsubscribe@googlegroups.com.
Andrew -
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/nZqi78iQgAYJ.
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.
To unsubscribe from this group, send email to dotnetopenid+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.
--
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/-/O3qnd7Ke5BEJ.
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.
To unsubscribe from this group, send email to dotnetopenid+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.
Thanks for the link to the documentation, which is extremely helpful. What I also really need to do is gain an understanding of the flow of function calls in the authorization server and the when and why each function would be called. For example, when would IsAuthorizationValid ever be called?
I thought that once the Authorization server did its job, it would be out of the way and would turn things over to a ResourceServer to check the access token and serve up resources to authorized clients.
Is there a non-WCF sample you could point me to that demonstrates how the resource server and authorization server work together to do that?
Also, the docs for TryAuthorizeResourceOwnerCredentialGrant say that I should "record an authorization entry such that subsequent calls to IsAuthorizationValid(IAuthorizationDescription) would return true." Since none of the sample code I have implements this method -- they all throw a NotImplementedException -- I am assuming that I need to record the access token and the client information in a database somewhere so that I can look it back up in IsAuthorizationValid to confirm that the access token is legit and belongs to the client that sent it?
There also seems to be some cryptographic signing of the access tokens going on in the methods that create them. Are these methods called automatically? Is DNOA expecting a specific crypto provider to be used? Do I need crypto at all, since the OAuth 2 spec seems to require TLS as opposed to signed tokens.
--
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/-/kovP36Cic9gJ.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
Based on your reply and a read of the source code, I think some of this is starting to sink in. I understand now based on the source and your reply to another post that the access token you generate is not just a random unique token but an encrypted/serialized collection of information about the sender, including the client id, the username and the access token expiration date and time. In DNOA the authorization server is used to read the token request, authorize the request and generate and send the access token response, which I assume you send in the appropriate json format according to the spec. Do I have any way of manually sending the token response rather than using the method call to do it for me?
I looked at David Christiansen's example for Web API and saw that the ResourceServer is used to decrypt/deserialize the access token received in the resource request, validate the contents and store the user information in the Principal so that it can be accessed by the controller's action method code. I was a little surprised to see that there was no check by the resource server against some sort of token store -- probably like the one or the same one that would be used to reauthorize the token in a refresh -- to verify that the access token had actually been granted to the client. I guess the assumption is that if the client has the token and it can be successfully decrypted/deserialized that it must have been granted by the authorization server.
Would it not be advisable to perform such a check?
That would also allow me to provide sliding expiration for my access tokens if the tokens were in some sort of store that included an expiration date that could be updated based on the last access.
Also, is it possible to add custom data to the access token without altering the core source code of DNOA? It would be useful to store a small amount of other info about the user or client in the token if the resource server is not looking up some corresponding token information in a store on each request.
Hey,
I'm in the same boat. Its not built in to dnoa, however, you web api is a mvc4 project. You can easily run it as MVC for the with server and web api as the resource server.
Since dnoa works in a distributed environment, this method works great. Trick is to only consider your web api as the resource serer only.
--
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/-/w-L9cLFsnQsJ.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/cMO5hR9Y8cUJ.
Hi Rich,What are the parameters you have send to get this response, i have send the parameters such as,scope=admin&grant_type=client_credentials&client_id=zamd&client_secret=test1243I am getting the reponse without refresh token, how to get the refresh token?
--
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/-/5Z6UFZZMuY0J.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.