如何保护使用 Springs REST Api 创建的 RESTful Web 服务?
我们有一个使用 Spring MVC 3.0 创建的 Spring Web 应用程序。在同一个应用程序中,我们使用 Springs 的 REST API 创建了 RESTful Web 服务。
现在我们需要保护这些网络服务。春天我们该怎么做呢?我们可以为此使用 Spring Security 吗?如果不是,还有什么其他选择?
谢谢。
We have a Spring web application created using Spring MVC 3.0 In the same application, we have created RESTful web services using Springs's REST API.
Now we need to secure those web services. How do we do this in spring? Can we use spring security for this? If not what are the other options?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上取决于您想要实施的安全级别。您可以仅使用基于 web.xml 的简单访问控制以及领域、用户名和密码。
Web 服务的安全性是另一回事。来自 Spring Security 常见问题解答:
Spring Security 当然是一个选择。在大多数情况下,它很容易(现在)与 Spring 集成,并且具有灵活的身份验证模块。
您还应该考虑 Apache Shiro。与 Spring Security 的比较问题已经得到解答 - Shiro 与 SpringSecurity 和 Shiro 也 与 Spring 很好地集成。
关于此主题还已经回答了一些其他问题 - 如何保护使用spring3服务REST?和寻找一个简单的Spring安全示例< /a>
我认为这个问题目前的形式没有明确的答案,但我希望这仍然有帮助。
It really depends on the level of security you want to impose. You could just use simple web.xml based access control with realms, usernames and passwords.
Security of your webservices is another matter. From the Spring Security FAQ:
Spring Security is certainly an option. It is for the most part, easy (nowadays) to integrate with Spring and has a flexible authentication module.
You should also consider Apache Shiro. A comparison to Spring Security question has already been answered - Shiro vs. SpringSecurity and Shiro also integrates nicely with Spring.
There are also some other questions already answered on this topic - How to secure a service REST with spring3? and Looking for a Simple Spring security example
I do not think there is a definitive answer to the question in it's current form, but I hope this helps all the same.