I have an application client that is attempting to connect to a WildFly 8.2 server using the remote JNDI (http-remoting) protocol. Below is my InitialContext configuration:
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);
The WildFly server is configured to use the standard ApplicationRealm. When I attempt to authenticate, I get the following in the client console:
ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:
After debugging the client connection code, I think the server is sending PLAIN as an acceptable SASL mechanism, but I can't get the client to use PLAIN.
I think that adding these properties to your props should fix the issue :
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");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.