Apache CXF:如何通过基本身份验证保护 JAX-RS Web 服务
我有一个 Spring 应用程序,它使用 Apache CXF(使用 jax-rs)发布一些 RESTful Web 服务。我想使用 HTTP 基本身份验证来保护对这些服务的访问。用户名和密码应该位于 Spring 配置文件中。主应用程序已经使用了 Spring Security,我不想弄乱该设置。
做到这一点最简单的方法是什么?我可以编写自己的 ServletFilter 但肯定必须有一种方法来配置它?
I have a Spring application that publishes some RESTful web services using Apache CXF (using jax-rs). I would like to secure access to those services using HTTP basic authentication. The username and password should be in a Spring configuration file. The main application already uses Spring Security and I would prefer not to mess with that setup.
What is the easiest way to do this? I could write my own ServletFilter but surely there must be a way to configure this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTTP Basic Authentication with Apache CXF Revisited 的作者 提供了实现 HTTP 基本身份验证验证的 CXF 拦截器的代码,以及如何定义安全拦截器并在简单端点上启用它的示例。
The author of HTTP Basic Authentication with Apache CXF Revisited provides the code of a CXF Interceptor that implements HTTP Basic Authentication validation and a sample of how to define the security interceptor and enable it on a simple endpoint.