build on working resource/client grant and test http client talking to an odata server–to buildout an odata proxy client


Now  that we have two clients working in command line windows (i.e. CGIs) able to talk to the authorization server to swap their vedor’s UA-usernametoken or the record owner’s User-usernametoken for an Access token, we have to focus next on the authorization grant case.  But BEFORE WE DO, lets imagine we were just going to use the client-credentials grant – be a (server-side) application (such as a CGI) that has UA-rights to talk at a a privileged “application” level of permission to the odata API.

Let’s update our shipper client, a WPF app, to prove that it can apply the resource-grant swapping of usernametokens for access tokens. Rather than hand code the test call, lets use the correct mechanism – an ODATA proxy. So, as usual let’s follow instructions and figure out why we don’t understand what is said.

First, update the tooling in visual studio – since for unknown reasons the service reference tool cannot apparently read the metadata from odata and produce the proxy.

image

http://blogs.msdn.com/b/odatateam/archive/2014/03/11/how-to-use-odata-client-code-generator-to-generate-client-side-proxy-class.aspx

image

To ensure it all works with the beta release of code we are using for odata hostsed in webAPI 2.2, lets follow how to modify the above:

image

http://blogs.msdn.com/b/webdev/archive/2014/03/13/getting-started-with-asp-net-web-api-2-2-for-odata-v4-0.aspx

image

image

With the odata server know to be running (without debug) and working as the webasip[ v2.2 based resource server (on http://localhost:38385/odata, per metadata reference, above), we run the custom tool, as commanded:

image

to get our client proxy:

image

How we test and secure it is a DIFFERENT question! BUT ITS not too hard (having removed the security guard at the controller, for now).

image

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in oauth, odata. Bookmark the permalink.