我想在WildFly 13中部署的受保护EJB上进行远程EJB调用。 EJB受Elytron保护,但由于某些原因,客户端应用程序始终因
而失败Suppressed: javax.security.sasl.SaslException: SCRAM-SHA-1: Server rejected authentication
依次来自
2018-07-23 13:19:25,116 TRACE [org.jboss.remoting.remote.server] (default task-3) Server sending authentication rejected: javax.security.sasl.SaslException: ELY05161: Unable to retrieve password for "admin"
at org.wildfly.security.mechanism._private.MechanismUtil.getPasswordCredential(MechanismUtil.java:141)
at org.wildfly.security.mechanism.scram.ScramServer.evaluateInitialResponse(ScramServer.java:205)
允许访问Bean的用户及其各自的角色存储在一个数据库中,为此我定义了Elytron jdbc-realm。
客户端代码:
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080");
env.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", false);
env.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", false);
env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
env.put("jboss.naming.client.ejb.context", true);
InitialContext ctx = new InitialContext(env);
// look up an EJB and invoke one of its methods (same as before)
CustomCodeRemote remote = (CustomCodeRemote)ctx
.lookup("myApp-all-5.4.1.4/myApp-all-ejbs/CACCustomCodeBean!com.business.customcode.CustomCodeRemote");