Wildfly 8.2应用程序客户端身份验证"所有可用的身份验证机制都失败了#34;

时间:2014-12-18 20:55:06

标签: java wildfly

我有一个应用程序客户端尝试使用远程JNDI(http-remoting)协议连接到WildFly 8.2服务器。下面是我的InitialContext配置:

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
props.put(Context.SECURITY_PRINCIPAL, userName);
props.put(Context.SECURITY_CREDENTIALS, password);
props.put("jboss.naming.client.ejb.context", true);
context = new InitialContext(props);

WildFly服务器配置为使用标准的ApplicationRealm。当我尝试进行身份验证时,我在客户端控制台中获得以下内容:

ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:

调试客户端连接代码后,我认为服务器正在将PLAIN作为可接受的SASL机制发送,但我无法让客户端使用PLAIN。

1 个答案:

答案 0 :(得分:0)

我认为在道具中添加这些属性可以解决问题:

    props.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
props.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
props.put("jboss.naming.client.ejb.context", "true");