Porting DotNetOpenAuth Samples to Asp.Net Version

Topics: ASP.NET MVC, ASP.NET Web API, ASP.NET Web Pages
Nov 13, 2012 at 8:04 AM

Hi All,

I'm currently implementing OAuth in my WebAPI project and need a few pointers.

I'm looking at the Samples that come with the DotNetOpenAuth and I the sample makes use of two classes in the OAuthAuthorizationServer sample:

IAuthorizationServerHost

and:

INonceStore, ICryptoKeyStore

Where in the Asp.Net version would I find analogies to these so I can follow through the flow to use a nonce store and authorise the client and resource owners?

Are there any samples doing this using the DotNetOpenAuth.Aspnet libraries?

Thanks,

Coordinator
Nov 13, 2012 at 4:22 PM

Those abstractions are used when implementing your own authorization server. ASP.NET currently only has support for acting as an OAuth client for various existing authorization servers (Facebook, Twitter, etc). We don't currently have a turn-key solution for implementing your own authorization server on ASP.NET, but the DotNetOpenAuth sample implementations of these interfaces are probably your best place to start.

Daniel Roth

Nov 13, 2012 at 5:11 PM

Hi Daniel,

Thanks for this.  I've been looking at this all day today and trying to piece together what path to take.

I initialliy pulled all the source for WebSecurity and OAuthWebSecurity into my own source as it didn't cover my requirements to starting to then try and incorporate the approaches in the DotNetOpenAuth started to look tricky.

I've implemented the nonce store and am now looking at the IAuthorizationServerHost in order to start producing AccessTokens.  Glad I'm on the right track and not re-implementing existing functionality.

What were the decisions behind embedding and extending DotNetOpenAuth?

Thanks,

Nov 16, 2012 at 1:30 PM

@findjammer,

Here are a couple of sample source files for the two interfaces you asked about:

https://github.com/DotNetOpenAuth/DotNetOpenAuth/blob/master/projecttemplates/RelyingPartyLogic/NonceDbStore.cs

https://github.com/DotNetOpenAuth/DotNetOpenAuth/blob/master/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs

I hope this helps.