REST HTTP认证 - 如何? [英] REST HTTP Authentication - How?

查看:213
本文介绍了REST HTTP认证 - 如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我开发使用RestEasy的和谷歌App Engine的一个REST Web服务。我的问题是不相关的GAE,但我只是在它的问题的情况下提到。它发生自然我需要保护我的资源和我自己的用户(不是谷歌的)。

So, I'm developing a REST webservice using RESTeasy and Google App Engine. My question isn't related to GAE, but I mentioned it just in case it matters. It happens that naturally I need to secure my resources and my own users (not Google's).

保护一个REST Web服务似乎是一个非常有争议的问题,或者至少是一个非常自由之一。 REST没有对此事的任何标准。从我研究了网络文学的,有一些我觉得可能适合我的应用程序至少3个方法:

Securing a REST webservice seems like a very controversial subject, or at least a very 'liberal' one. REST doesn't impose any standard on this matter. From what I've researched on the web and literature, there are at least 3 approaches that I think might fit in my application:


  • HTTP基本(使用SSL)

  • HTTP摘要(使用SSL)

  • 的OAuth

  • HTTP Basic (with SSL)
  • HTTP Digest (with SSL)
  • OAuth

OAuth的似乎是最完整的方法。但我不认为就需要这样的复杂性,因为我不需要授权任何第三方应用程序。这是我自己的客户端应用程序使用一个Web服务只。

OAuth seems like the most complete approach. But I don't think that such a complexity is needed because I will not need to authorize any 3rd party applications. It is a webservice to be consumed by my own client applications only.

HTTP基本 HTTP摘要显示作为网络上最简单的,但事实是,我从来没有发现使用它们RestEasy的一个具体实现,例如。
我发现<一个href=\"http://docs.jboss.org/resteasy/docs/2.3.0.GA/userguide/html/Securing_JAX-RS_and_RESTeasy.html\">this页面和 RestEasy的文档中的这一个。他们确实很有趣,但他们告诉很少或没有对这个问题(HTTP Basic或摘要)。

HTTP Basic and HTTP Digest appear as the most simple ones on the web, but the fact is that I've never found a concrete implementation of them using RESTeasy, for example. I've found this page and this one in RESTeasy's documentation. They are indeed very interesting, but they tell little or nothing on this subject (HTTP Basic or Digest).

所以,在这里我问:

如何安全使用HTTP Basic或文摘RestEasy的?我的WebService

也许它是如此简单,这是不值得一提的文档中或其他地方?
此外,如果任何人都可以向我提供有关保护的RESTful web服务的事情的一些见解,也可能是有帮助的。

Perhaps it is so simple that it isn't worth mentioning in the documentation or anywhere else? Also, if anyone can provide me some insight on the matter of securing RESTful webservices, it could be helpful.

我是否选择正确的方法?

推荐答案

我已经成功通过RestEasy的的拦截器来完成。
基本要求是通过使用像类的监听截获。在这一类我检查的请求的HTTP头,然后正常的基本认证过程在继续。

I've managed to accomplish this by using RESTeasy's Interceptors. Basically the requests are intercepted by using a listener like class. In this class I inspect for the request's HTTP headers and then the normal Basic-Auth process goes on.

相关链接:

http://en.wikipedia.org/wiki/Basic_access_authentication 结果
<一href=\"http://stackoverflow.com/questions/3892682/passing-parameters-in-the-message-header-with-a-rest-api\">Passing在邮件标题参数与一个REST API 结果
http://www.alemoi.com/dev/httpaccess/ (Servlet的一部分)

http://en.wikipedia.org/wiki/Basic_access_authentication
Passing parameters in the message header with a REST API
http://www.alemoi.com/dev/httpaccess/ (the Servlet part)

我希望这可以帮助任何人。

I hope this helps anyone.

感谢。

这篇关于REST HTTP认证 - 如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆