簡體   English   中英

遠程連接到JBoss 4.2.3的身份驗證

[英]Authentication in Remote Connection to JBoss 4.2.3

我正在嘗試連接到JBoss MBean,但由於身份驗證失敗而被阻止。

        Hashtable<String, String> env = new Hashtable<String, String>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        env.put(Context.PROVIDER_URL, "jnp://"+testIP+":"+testPort);
        env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

        env.put(Context.SECURITY_PRINCIPAL, "admin");
        env.put(Context.SECURITY_CREDENTIALS, "admin");

        InitialContext ic = new InitialContext(env);
        RMIAdaptor server = (RMIAdaptor) ic.lookup("jmx/invoker/RMIAdaptor");
        // Get the MBeanInfo for the JNDIView MBean
        ObjectName name = new ObjectName("my.service:service=MyBean");
        MBeanInfo info = server.getMBeanInfo(name);         

一切似乎在連接方面表現得很好,直到我得到的最后一行:

java.lang.SecurityException: Failed to authenticate principal=null, securityDomain=jmx-console
at org.jboss.jmx.connector.invoker.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:97)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
:
:

安全域配置為使用JAAS(在jmx-invoker-service.xml中):

<interceptor code="org.jboss.jmx.connector.invoker.AuthenticationInterceptor"
                 securityDomain="java:/jaas/jmx-console"/>

並且用戶在jmx-console-users.properties中正確定義。

在我看來,校長根本沒有被正確閱讀。 JBoss使用的不是Context.SECURITY_PRINCIPAL / CREDENTIALS嗎? 他們的命名文檔中可以看出他們沒有,但為什么會失敗呢?

非常感謝,

-C

嘗試設置初始上下文工廠,如下所示:

env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.LoginInitialContextFactory");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM