使用对Wildfly 10的远程EJB调用进行身份验证时出现问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用对Wildfly 10的远程EJB调用进行身份验证时出现问题相关的知识,希望对你有一定的参考价值。
我正在尝试对我的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);
我不完全确定这个runAs
或runAsPrincipal
是否是远程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-client.properties中有一个拼写错误
remote.conncetion.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS = JBOSS-LOCAL-USER
应该是remote.connection.default.connect.options等
以上是关于使用对Wildfly 10的远程EJB调用进行身份验证时出现问题的主要内容,如果未能解决你的问题,请参考以下文章
Java EE 远程客户的访问EJB实现实例(Jboss wildfly)
WildFly JNDI 查找部署在 WAR 中的本地 EJB
EJB 远程客户端从 JBoss AS 7.1 迁移到 Wildfly 8.1
EJB远程客户端从JBoss AS 7.1迁移到Wildfly 8.1