如何为每个 webapp 定义 Tomcat 安全领域

发布于 2024-10-06 00:34:13 字数 338 浏览 1 评论 0原文

当将 JAAS JDBCRealms 与 Tomcat 一起使用时,我通常在 server.xml 中定义领域。但现在我正在寻找一种更简单的解决方案,在部署应用程序时不必配置 Tomcat 容器。

如果可能的话,我想将所有 JAAS 配置保留在 web.xml 中,并只定义每个应用程序/webapp 的领域。

一个线程提到他通过在 web 应用程序的 META-INF/context.xml 中定义领域来做到这一点。但我无法让它工作(

请帮助我在 .war 中找到正确的位置来定义随后用于该 Web 应用程序的 org.apache.catalina.realm.JDBCRealm。

When using JAAS JDBCRealms with Tomcat, I usually define the realm in server.xml. But now I am looking for a simpler solution, where I don't have to configure the Tomcat container when deploying the application.

If possible, I would like to keep all the JAAS configuration in web.xml and just define the realm per application/webapp.

One thread mentions that he did this by defining the realm in META-INF/context.xml of the webapp.. but I could not get it working (Why is Tomcat manager using my LoginModule?).

Please help me find the correct location in the .war to define a org.apache.catalina.realm.JDBCRealm that is then used for that webapp.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

恬淡成诗 2024-10-13 00:34:13

要定义您自己的 JDBCRealm,请在您自己的 Web 应用程序中创建一个 META-INF/context.xml

根据 Tomcat 服务器版本的规范配置 JDBCRealm:

这些链接向您展示了如何配置 JDBCRealm。

To define your own JDBCRealm, create a META-INF/context.xml in your own web application.

Configure your JDBCRealm according to the specification based on your Tomcat Server versions:

These links shows you exactly how to configure JDBCRealm.

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