规划从 jboss 到 openliberty 的迁移

问题描述 投票:0回答:2

我计划将我的应用程序从 jboss 迁移到 openliberty。在jboss中,我使用DatabaseServerLoginModule完成身份验证和角色映射并在standalone.xml文件中进行配置。 如何使用 openliberty 实现同样的目标?我使用java作为后端。

authentication jboss open-liberty
2个回答
1
投票

只是想留下以下关于如何在 openliberty 中配置 JAAS loginModules 的文章供您查看。 希望您的 DatabaseServerLoginModule 能够神奇地工作或只需进行微小的更改即可工作。

Liberty 的身份验证概述 https://openliberty.io/docs/latest/authentication.html

逐步配置JAAS(本文针对商业Liberty。与开放Liberty的步骤相同) https://www.ibm.com/docs/en/was-liberty/base?topic=liberty-configuring-jaas-custom-login-module

参考 https://openliberty.io/docs/latest/reference/config/jaasLoginModule.html


0
投票

DatabaseServerLoginModule
是一个较旧的 JBoss SPI,看起来它在最近的版本中已从 Wildfly 中删除,因为它使用了 JDK 中不再存在的安全 API。

正如 Hiroko 所链接的,OpenLiberty 有许多身份验证选项

对于应用程序身份验证,来自 Jakarta Security 的 @DatabaseIdentityStoreDefinition 将是一个很好的替代品,下面是 servlet 的示例:

@BasicAuthenticationMechanismDefinition(realmName = "JavaEESec Basic Realm")
@DatabaseIdentityStoreDefinition(
                                 callerQuery = "select password from callertable where name = ?",
                                 groupsQuery = "select group_name from callertable_groups where caller_name = ?",
                                 dataSourceLookup = "java:comp/env/jdbc/derby1fat")

public class DatabaseAuthAliasBasicAuthServlet extends FlexibleBaseServlet {

对于授权,您可以将用户/组映射到server.xml中的角色:

<application type="war" id="myWebApp" name="myWebApp"
             location="${server.config.dir}/apps/myWebApp.war">
   <application-bnd>
       <security-role name="testing">
           <user name="Bob" />
           <user name="user1" />
           <group name="users" />
       </security-role>
   </application-bnd>
</application>

如果您需要数据库支持的服务器身份验证,我会考虑创建自定义用户注册表: https://community.ibm.com/community/user/wasdevops/blogs/hiroko-takamiya1/2021/11/19/configuring-custom-user-registry-liberty

Hiroko 有一个 git 存储库,其中包含示例:https://github.com/una-tapa/bellscur

© www.soinside.com 2019 - 2024. All rights reserved.