配置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
相关产品推荐
相关产品推荐

