Apache CXF:如何通过基本身份验证保护 JAX-RS Web 服务

发布于 2024-08-06 03:46:23 字数 219 浏览 7 评论 0原文

我有一个 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 技术交流群。

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

发布评论

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

评论(1

呆萌少年 2024-08-13 03:46:23

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.

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