将 SSL 与部署在 IBM-WASCE 上的应用程序结合使用

发布于 2024-08-13 14:24:40 字数 1299 浏览 5 评论 0原文

我有一个使用 JSP 和 Servlet 并部署在 IBM-WASCE 2.1 上的应用程序。 我希望应用程序使用 SSL 进行登录。根据文档,我将以下行添加到 web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

        <!-- Usual servlet mapping code -->

  <security-constraint>
        <web-resource-collection>
            <web-resource-name>Login</web-resource-name>
            <url-pattern>/login.jsp</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

但是我收到一个错误,指出,

Web 应用程序的 web.xml default/foo/1.0/car 包含安全性 Geronimo 部署计划之外的元素 未提供或不包含 元素 需要配置安全性 相应地。

如何从这里继续?要向文件 geronimo-web.xml 添加哪些元素?

I have an application which uses JSPs and Servlets and deployed on IBM-WASCE 2.1.
I want the application to use SSL for login purposes. Based upon the documentation, I added the following lines to web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

        <!-- Usual servlet mapping code -->

  <security-constraint>
        <web-resource-collection>
            <web-resource-name>Login</web-resource-name>
            <url-pattern>/login.jsp</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

However I get an error which states,

web.xml for web app
default/foo/1.0/car includes security
elements but Geronimo deployment plan
is not provided or does not contain
element
necessary to configure security
accordingly.

How to proceed from here? What elements to add to the file geronimo-web.xml?

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

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

发布评论

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

评论(1

云淡月浅 2024-08-20 14:24:40

[已解决]

必须在文件 geronimo-web.xml 中进行以下修改。

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
  <sys:environment>
    <sys:moduleId>
      ...
           <!-- Basic stuff -->
      ...
    </sys:moduleId>


  </sys:environment>
  <context-root>/foo</context-root>

  <security-realm-name>geronimo-admin</security-realm-name>
    <security>
        <default-principal>
            <principal name="anonymous" class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"
            />
        </default-principal>
        <role-mappings>
            <role role-name="admin">
                <principal name="administrators" designated-run-as="true" 
                class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"         
                />
                <principal name="root"
class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"
                />
            </role>
        </role-mappings>
    </security>
</web-app>

[Solved]

The following modifications had to be done in the file geronimo-web.xml.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
  <sys:environment>
    <sys:moduleId>
      ...
           <!-- Basic stuff -->
      ...
    </sys:moduleId>


  </sys:environment>
  <context-root>/foo</context-root>

  <security-realm-name>geronimo-admin</security-realm-name>
    <security>
        <default-principal>
            <principal name="anonymous" class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"
            />
        </default-principal>
        <role-mappings>
            <role role-name="admin">
                <principal name="administrators" designated-run-as="true" 
                class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"         
                />
                <principal name="root"
class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"
                />
            </role>
        </role-mappings>
    </security>
</web-app>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文