【问题标题】:Porting j_security_check from JBOSS to Websphere将 j_security_check 从 JBOSS 移植到 Websphere
【发布时间】:2012-05-15 19:40:17
【问题描述】:

我在我的 struts web 项目中使用j_security_check,我将它部署在 jboss 中。

在我的web.xml 中,我定义了角色testuser,创建了一个包含users.propertiesroles.properties 的jar 文件,jar 名称为TestUserInfo.jar,其中Test 是应用程序的名称。

我的web.xml

<security-constraint>
    <display-name>To secure Test site</display-name>
    <web-resource-collection>
        <web-resource-name>test_actions</web-resource-name>
        <url-pattern>*.action</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>testuser</role-name>
    </auth-constraint>
</security-constraint>

<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>test offshore realm</realm-name>
    <form-login-config>
        <form-login-page>/login_form.jsp</form-login-page>
        <form-error-page>/login_error.jsp</form-error-page>
    </form-login-config>
</login-config>

<security-role>
    <role-name>testuser</role-name>
</security-role>

users.properties 文件将 username=password 作为名称值对,roles.propertiesusername=role(在我的情况下为 user=testuser)作为名称值对。

当应用程序部署在 JBoss 中时,我可以使用 users.properties 文件中的用户名和密码登录。 TestUserInfo.jar 保留在 jboss-5.1.0.GA\jboss-5.1.0.GA\server\default\lib 下。

我必须在 websphere 中做什么才能实现相同的功能?

【问题讨论】:

    标签: jakarta-ee websphere jboss5.x j-security-check


    【解决方案1】:

    您必须使用“基于文件的自定义用户注册表”。以下链接提供了有关如何配置它的详细信息(此示例中的 users.props 和 groups.props 文件将包含与您的 users.properties 和 roles.properties 文件中相同的信息)。该链接适用于 WAS v6。如果您使用的是其他版本,您可以在信息中心搜索与您的版本相同的概念。

    Configuring custom user registries

    【讨论】:

    • 谢谢.. 我需要更改我的 Java struts 应用程序中的任何代码吗??
    • 无需进一步更改,因为您使用的是标准授权安全性。
    • 你能帮我在 J2ee 应用程序中进行哪些更改吗?有链接吗??
    • 您无需更改应用程序中的任何内容。只需要服务器配置;遵循上述链接中的 13 个步骤就足够了。
    【解决方案2】:

    WebSphere 支持许多注册中心,如今联合存储库已成为 WAS 中的标准。

    联合存储库可以由基于文件的文件组成(文件系统中存储用户/密码、组等的文件、LDAP 服务器、数据库等。

    最终,用户信息存储在某个注册表中。 JBoss/tomcat 将它们保存在不同的文件中(如您提到的名称),并且还支持 LDAP 和可能的其他用户注册表。类似地,WAS 支持多个这样的用户注册表。

    您可以挑选最适合您的环境的。

    阅读本文以更好地理解这个空间

    http://www.ibm.com/developerworks/websphere/techjournal/0701_ilechko/0701_ilechko.html

    简而言之,如果你想存储你的用户,最简单的选择是fileRegistry.xml

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-21
      • 1970-01-01
      • 2012-04-24
      • 1970-01-01
      • 2014-09-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多