我正在尝试将 J2EE 应用程序从 Tomcat 移植到 Websphere,但我对 Websphere 不太熟悉。
我遇到的唯一问题是授权(我在 web.xml 中使用基本身份验证)。在 Tomcat 中,我使用 tomcat-users.xml 文件来定义我的用户/密码以及他们所属的角色。
我如何在 Websphere 中“简单”地做到这一点?将 EAR 部署到 Websphere 时,它还要求我将我的角色从 web.xml 映射到用户或组。
我必须建立某种领域吗?自定义用户注册表?
谢谢。
更新:
我配置了一个独立的自定义注册表,但是我无法获得用户名/密码的登录提示。它在 Tomcat 中运行良好,但在 Websphere 中却不行。
来自 web.xml 的代码
<security-constraint>
<web-resource-collection>
<web-resource-name>basic-auth security</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>HELLO_USER</role-name>
</auth-constraint>
<user-data-constraint>NONE</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>HELLO_USER</role-name>
</security-role>