Websphere 中 JMX 的编程身份验证

发布于 2024-08-19 06:52:13 字数 378 浏览 3 评论 0原文

我们希望对 Websphere Application Server 中其他已部署的应用程序进行 JMX 调用。如果您在用户使用正确凭据登录的 Web 应用程序中执行此操作,则效果很好。但是,如果您尝试进行 JMX 调用(例如,从应用程序的计时器触发部分进行 JMX 调用,而该部分与任何登录用户都没有连接),那么您会得到一个 javax.management.JMRuntimeException:ADMN0022E 这表明您无权使用 JMX。

所以我的问题是:如何为 JMX 操作提供一些凭据?有没有办法以编程方式“模拟”登录,或者以某种方式提供身份验证主题以便完成调用?如何避免将实际用户的用户名和密码放入代码/属性文件中?

如果重要的话:我们使用 Websphere 6.1,并使用 Spring。

We would like to make JMX calls to other deployed applications within Websphere Application Server. This works fine if you do this within a web application where a user does a login with the right credentials. However if you try to make JMX calls, say, from a timer triggered part of the application that has no connection to any logged in user, you get a
javax.management.JMRuntimeException: ADMN0022E
that says you don't have the rights to use JMX.

So my question is: how can I provide some credentials to the JMX operation? Is there a way to "simulate" a login programmatically, or some way to provide a authentication subject such that the call is done? And how can I avoid to put the username and password of an actual user into the code / a property file?

In case that matters: we use Websphere 6.1, and work with Spring.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请远离我 2024-08-26 06:52:13

IBM WebSphere Application Server V6.1 安全手册第 9.6 章启发了我

CallbackHandler loginHandler = new com.ibm.websphere.security.auth.callback.WSCallbackHandlerImpl("username","password");
LoginContext lc = new LoginContext("WSLogin", loginHandler);
lc.login();
Subject subject = lc.getSubject();
PrivilegedAction<Whateverresulttype> action = new PrivilegedAction<Whateverresulttype>() {
    public Health run() {
        return Health.valueOf(mbean.whatevercall());
    }
};
Whateverresulttype res = (Whateverresulttype) com.ibm.websphere.security.auth.WSSubject.doAs(subject, action);

:我现在唯一需要知道的是如何避免将实际用户的凭据放入代码中。 8-)

The IBM WebSphere Application Server V6.1 Security Handbook Chapter 9.6 enlightened me:

CallbackHandler loginHandler = new com.ibm.websphere.security.auth.callback.WSCallbackHandlerImpl("username","password");
LoginContext lc = new LoginContext("WSLogin", loginHandler);
lc.login();
Subject subject = lc.getSubject();
PrivilegedAction<Whateverresulttype> action = new PrivilegedAction<Whateverresulttype>() {
    public Health run() {
        return Health.valueOf(mbean.whatevercall());
    }
};
Whateverresulttype res = (Whateverresulttype) com.ibm.websphere.security.auth.WSSubject.doAs(subject, action);

The only thing I need to find out now is how I can avoid to put credentials of an actual user into the code. 8-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文