我想在 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");