Using OAuth for server-to-server authentication?

南楼画角 提交于 2019-11-28 23:06:47

Yes, the lifetime of the token can be set not to expire until you say so. So, you'd (manually) complete the authentication and authorisation, and save the authorized token for later use.

(You can use any test client to help you complete that manual part, or while you're implementing the server yourself: use a so-called two-legged OAuth.)

Chris Harris

There are actually two OAuth specifications, the 3-legged version and the 2-legged version. The 3-legged version is the one that gets most of the attention.

The 2-legged version does exactly what you want initially, it allows an application to grant access to another via either a shared secret key (very similar to Amazon's Web Service model, you will use the HMAC-SHA1 signing method) or via a public/private key system (use signing method: RSA-SHA1). The bad news, is that it's not nearly as well supported yet as the 3-legged version yet, so you may have to do a bit more work than you otherwise might have to right now.

Basically, 2-legged OAuth just specifies a way to "sign" (compute a hash over) several fields which include the current date, a random number called "nonce," and the parameters of your request. This makes it very hard to impersonate requests to your web service.

OAuth is slowly but surely becoming an accepted standard for this kind of thing -- you'll be best off in the long run if you embrace it because people can then leverage the various libraries available for doing that.

Getting both 2-legged and 3-legged to work simultaneously is kind of tricky right now -- but it is possible (Google has it working right now). http://code.google.com/apis/accounts/docs/OAuth.html

Greg:

I have been working on an extension to the OAuth core that I think may answer you need. We wanted to write applications against our own API, but we felt it did not make much sense to not allow our own applications (As the service provider) to collect credentials directly from the user / consumer application - since we already would be considered a trusted party to ourselves.

The extension allows for 1st, 2nd, and of course 3rd party (traditional OAuth), while using the security of tokens and secrets, and signing, etc... that the Protocol provides.

Our beta documentation on the extension can be found here.

If it's only about server-to-server communication, I would consider using authorization based on API key - just like bit.ly or FriendFeed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!