You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

配置Liberty通过JNDI暴露User Registry,实现角色用户反向查询

在Liberty或OpenLiberty中反向查询拥有指定角色的用户

我正在解决的问题是:如何在Liberty或OpenLiberty环境中,反向查询拥有指定角色的用户。我希望能在应用内部通过JNDI访问用户注册表(不管底层使用哪种Java API)。

搜索过程中,我找到了适用于WAS classic的示例代码:

import com.ibm.websphere.security.UserRegistry;

{
  Context ic = new InitialContext();
  Object objRef = ic.lookup("UserRegistry");
  UserRegistry userReg = (UserRegistry)PortableRemoteObject.narrow(objRef, UserRegistry.class);
  ...
}

注:我还没测试过这段代码,不确定是否可行。

但目前我的服务器JNDI根上下文中并没有"UserRegistry"这个绑定,仅能看到"ejb"、"jdbc"、"services"以及server.xml中配置的其他私有绑定。

内容的提问来源于stack exchange,提问作者rslemos

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 15:52:13