可以通过 oauth 处理登录的 REST 客户端

发布于 2024-08-17 18:58:24 字数 415 浏览 2 评论 0原文

我正在基于 Rest API 的系统上担任测试人员。我的部分工作是使用不同的应用程序将文件 POST 到 Rest API,然后通过 Rest 客户端直接访问 API 以验证 XML 是否正确。

到目前为止,我一直在使用 RESTClient firefox 插件。

但现在我们正在摆脱旧的登录方式,转而使用 Oauth。这一切都很好,但它使测试变得更加困难,因为我无法(不知道如何?)如何使用我正在使用的 REST 客户端访问 Rest API。我不知道还有其他 REST 客户端可以做到这一点。

我需要一个可以通过 oauth 处理登录的 REST 客户端/REST 浏览器。

更新:
你好。我仍在寻找更多可以处理 Oauth 的优秀 REST 客户端。因此,如果您知道任何内容,我将不胜感激下面的帖子。

I am working as a tester on a system based on a Rest API. Part of my job is to use different applications to POST files to the Rest API and then accessing the API directly via a Rest Client to verify that the XML is correct.

So far I have been using the RESTClient firefox add-on.

But now we are getting rid of our old login in favour of Oauth. This all good and all but it makes testing harder since I can't ( don't know how? ) how to access the Rest API using the REST client I am using. And I don't know of any other REST client that can do this.

I need a REST Client/REST browser that can handle login via oauth.

Update:
Hi. I am still looking for more good REST Clients that can handle Oauth. So if you know any I would appreciate a post below.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

作业与我同在 2024-08-24 18:58:24

我也在寻找这样的东西,自从这个问题以来,事情似乎发生了一些变化。

我正在使用 Chrome,REST 控制台扩展非常适合我:

https://chrome.google。 com/webstore/detail/cokgbflfommojglbmbpenpphppikmonn

I was also looking for such a thing and since this question things seem to have moved on a bit.

I'm using Chrome and the REST Console extension works brilliantly for me:

https://chrome.google.com/webstore/detail/cokgbflfommojglbmbpenpphppikmonn

岁吢 2024-08-24 18:58:24

我是 RESTClient 的作者,我已经开始开发新版本的 RESTClient(版本 1.4.0)。新版本将支持oAuth 2.0。并且将于四月份发布。

I'm author of RESTClient, and I already started to develop a new version of RESTClient (version 1.4.0). The new version will support oAuth 2.0. And it will be released in April.

雾里花 2024-08-24 18:58:24

当 REST API 使用 OAuth 身份验证时,没有什么可以阻止您继续手动测试 REST API。 OAuth 只需要您发送额外的参数:首先,您协商 OAuth 舞蹈以获取请求令牌并将其交换为访问令牌,然后每个请求都具有必要的 OAuth 参数 (oauth_consumer_key, oauth_token, oauth_signature_method, oauth_signatureoauth_timestampoauth_nonce)。您需要使用单独的工具来进行签名(除非您正在测试的产品愿意使用 PLAINTEXT 作为签名方法),但您可以简单地手动复制所有这些值到您当前的手动工具。

如果这听起来工作量很大,那么你是对的!我认为现在是转向自动化测试的好时机。 大多数语言都存在库,可以以编程方式使用 OAuth 服务,并且可以处理所有这些参数并为您签名。您可以构建一个通用工具,让手动测试人员手动指定 URL 和参数,或者更进一步,编写一些自动完成所有生成和验证的工具。

更新:为了从命令行进行一些探索性测试,拥有一个类似 curl 的工具来处理一些 OAuth 参数和签名肯定会有所帮助。查看 oauth-proxy ,它可能适合您-- 它专门用于在命令行上探索 API。或者您可能会发现,对于您的特定探索,您希望围绕 oauth-proxy 构建一个脚本,或者在适用于不同语言的众多 OAuth 库之一之上构建一个工具。

There's nothing that prohibits you from continuing to test a REST API manually when it uses OAuth authentication. OAuth simply requires that you send additional parameters: first that you negotiate the OAuth dance to get a request token and exchange it for an access token and then that each request has the necessary OAuth parameters (oauth_consumer_key, oauth_token, oauth_signature_method, oauth_signature, oauth_timestamp and oauth_nonce). You'd need to use a separate tool to do the signing (unless the product you're testing is willing to use PLAINTEXT as the signature method), but you could simply copy all of these values in manually to your current manual tool.

If that sounds like a lot of work, you're right! I think this is a good time to switch to automated testing. Libraries exist for most languages to consume OAuth services programmatically and that would handle all of those parameters and signing for you. You could build a generic tool that let a manual tester specify URLs and parameters by hand, or go farther and write something that did all the generation and validation automatically.

Update: for doing some exploratory testing from the command line, it would certainly be helpful to have a curl-like tool that handles some of the OAuth paramaters and signing. Check out oauth-proxy which may work for you -- it's intended exactly for exploring APIs on the command line. Or you may find that for your particular explorations, you want to build a script around oauth-proxy or a tool on top of one of the many OAuth libraries for different languages.

迎风吟唱 2024-08-24 18:58:24

原来RESTClient确实支持oauth,但是新版本还没有发布。

从 sourceforge 查看最新代码
http://sourceforge.net/projects/restclient/develop
并使用这些文件替换您的 RESTClient(应在您的 Firefox 配置文件目录中找到
http://support.mozilla.com/en-US/kb/Profiles#如何查找您的个人资料)。

注意:我必须破解源代码并删除“领域”参数,因为我们的系统不需要它。根据 Oauth 规范,领域是可选的,我已要求 RESTClient 的开发人员在未来版本中将其设为可选。

Turns out RESTClient does support oauth but that the new version has not been released yet.

Checkout the lastest codes from sourceforge
http://sourceforge.net/projects/restclient/develop
And use those files to replace your RESTClient (which should be found in your firefox profile directory
http://support.mozilla.com/en-US/kb/Profiles#How_to_find_your_profile ).

Note: I had to hack the source and remove the "realm" parameters since our system didn't want it. According to Oauth spec realm is optional and I have asked the developers of RESTClient to make it optional in the future releases.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文