RESTful 交叉身份验证
我在 JAX-RS(泽西岛)中实现了 2 个 RESTful 服务:“A”和“B”。它们部署在单独的应用程序服务器上。 “A”和“B”都是我的。
- 客户端连接并登录“A”服务;
- 客户端向“A”请求资源,例如:https://blabla1/services/myresources;
- 要检索资源“myresources”,服务“A”应向服务“B”询问(而不是重定向)另一个资源,例如: https: //blabla2/services/anotherresources。
服务“B”也需要身份验证,这就是问题所在。服务“A”是否有可能向“B”询问客户端身份验证参数,以及它将如何工作?
我想使用 oauth 库是可能的,但我找不到任何示例(接近我的问题)和操作方法。
谢谢
I have 2 RESTful services realized in JAX-RS (Jersey): "A" and "B". They are deployed on a separate application servers. "A" and "B" are both of mine.
- Client connect and login at "A" service;
- Client ask "A" for resource, for example: https://blabla1/services/myresources;
- For retrieve resource "myresources" service "A" should ask (not redirect) service "B" for another resource, for example: https://blabla2/services/anotherresources.
Service "B" need authenticate too, that's the problem. Is it possible, that service "A" ask "B" with client authentication parameters, and how it will works ?
I guess it's possible with oauth library, but I can't find any examples (close to my problem) and howto's.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是总结评论中概述的解决方案:
服务“B”(或其前面的代理)应该只接受带有服务器“A”证书的 HTTPS 请求。 (服务器“A”还可以验证服务器“B”的证书以避免中间人攻击。)
然后用户名可以是纯文本请求参数。
如果您拥有比服务器人员更好的网络人员,或者发现 SSL 令人畏惧,请让网络人员在您的站点之间建立安全隧道(形成 VPN),并使除隧道之外的原始 Internet 上的服务“B”不可用。
Just summarizing the solution outlined in the comments:
Service "B" (or a proxy in front of it) should only accept HTTPS requests with the certificate of server "A". (Server "A" can also validate server "B"'s certificate to avoid man in the middle attacks.)
Then the user name can be a plain text request parameter.
If you have better networking people than server people or find SSL daunting, have the network people establish a secure tunnel (forming a VPN) between your sites instead, and make service "B" unavailable from the raw Internet besides the tunnel.