使用对Wildfly 10的远程EJB调用进行身份验证时出现问题

问题描述 投票:0回答:1

我正在尝试对我的Wildfly 10 / JBoss 7 EAP服务器进行远程EJB调用,但在我的Wildfly服务器上不断收到无效用户错误消息(我的EJB称为LoginManager):

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文件中。

我已经尝试在第54行的SecurityContextInterceptor类中的Wildfly服务器本身中添加断点,并看到主体为null:

                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需要做什么?

jboss ejb wildfly-10
1个回答
0
投票

你的jboss-ejb-client.properties中有一个拼写错误

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

应该是remote.connection.default.connect.options等

© www.soinside.com 2019 - 2024. All rights reserved.