有没有办法强制使用 REST 服务发起请求
我有一组 REST 服务,我只想让我的 Web 应用程序使用它们。我不希望我的用户能够使用他们的凭据并让第三方应用程序使用服务(因为我的数据是付费的)。我有一种方法可以确保只有我的 javascript 可以从不能被欺骗的浏览器调用服务(例如,请求标头和用户代理检测将不起作用。)
这可能更像是一个创造性问题。
I have a set of REST services that I ONLY want my web application to consume. I do not want my users to be able to use their credentials and have the services consumed by a third party application (since my data is paid for). I there a way to ensure that only my javascript can make calls to the services from a browser that cannot be spoofed (request headers and user agent detection for instance will not work.)
This is probably more of a creative problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还提供了一个 REST API。我使用混合的 API 密钥,该密钥始终是静态的并且可以被欺骗。接下来是一个签名,它将在客户端生成并在服务器端针对每个请求进行验证。签名是由所有参数和秘密密码的组合构建的。这可以防止中间人执行例如使用另一个参数的相同调用。
唯一不好的是欺骗性请求可以再次发送。我已经不知道如何防止这种情况。
I am also providing a REST API. I use a mix of an API Key which is always static an can be spoofed. Next is a signature which will be generatet on clinet side and prooved on server side on each request. The signature is build by a combination of all parameters AND a secret password. this prevent a man in the middle from executing for example the same call with another parameter.
Only bad is that a spoofed request can be sent again. I dont know already how to prevent that.
签名的客户端证书和 HTTPS。
Signed client certificates and HTTPS.