2017-06-15 62 views
0

我試圖對我的Wildfly 10/JBoss 7 EAP服務器執行遠程EJB調用,但在我的Wildfly服務器上始終收到無效的用戶錯誤消息(我的EJB被稱爲LoginManager) :使用遠程EJB調用Wildfly 10進行身份驗證的麻煩

23:04:02,872 ERROR [org.jboss.as.ejb3.invocation] (default task-6) WFLYEJB0034: EJB Invocation failed on component LoginManager for method public abstract java.lang.String ejbs.LoginManagerRemote.echo(java.lang.String): javax.ejb.EJBAccessException: WFLYSEC0027: Invalid User 
    at org.jboss.as.ejb3.security.SecurityContextInterceptor$1.run(SecurityContextInterceptor.java:69) 
    at org.jboss.as.ejb3.security.SecurityContextInterceptor$1.run(SecurityContextInterceptor.java:49) 
    at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:97) 

我已經使用add-user.sh/bat腳本將我的用戶添加到了application-users.properties文件。

我在斷點試圖把在Wildfly服務器本身在SecurityContextInterceptor班線54上,看到的主要是空:

   if (holder.skipAuthentication == false) { 
        holder.securityManager.authenticate(holder.runAs, holder.runAsPrincipal, holder.extraRoles); 

我不能完全肯定這是否runAsrunAsPrincipal是遠程EJB調用傳遞的主體/憑證,但我懷疑它可能是我的問題的原因。

我打電話遠程EJB爲:

Properties p = new Properties(); 
    p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); 

    final Context context = new InitialContext(p); 
    LoginManagerRemote ejb = (LoginManagerRemote) context.lookup("ejb:ear-1.0/ejbs-1.0//LoginManager!ejbs.LoginManagerRemote"); 

    return ejb.echo("test"); 

我jboss-ejb-client.properties爲:

remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false 

remote.connections=default 

remote.connection.default.host=localhost 
remote.connection.default.port=8080 
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false 
remote.conncetion.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER 
remote.connection.default.username=test 
remote.connection.default.password=test 

難道我做錯了什麼?我在某處丟失了什麼明顯的東西嗎?我需要做什麼才能成功調用遠程EJB?

回答

0

有一個在你的jboss-ejb-client.properties一個錯字

remote.conncetion.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS = JBOSS-LOCAL-USER

應該是遙控器.connection.default.connect.options etc等