<div>Hi all,</div><div> </div><div>I have tried many days but failed finding where my problem is. The scenario is to invoke remote secured ejb on JBAS 7.1 final </div><div> </div><div>=====================server side stuff below ===================</div>
<div> </div><div>modification to "standalone-full-ha.xml"</div><div> </div><div> <security-realm name="ApplicationRealm"><br> <authentication><br> <properties path="application-users.properties" relative-to="jboss.server.config.dir"/><br>
</authentication><br> </security-realm></div><div>....</div><div> </div><div> <subsystem xmlns="urn:jboss:domain:remoting:1.1"><br> <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"><br>
<sasl><br> <policy><br> <no-anonymous value="true"/><br> <no-plain-text value="false"/><br> <pass-credentials value="true"/><br>
</policy><br> </sasl><br> </connector><br> </subsystem></div><div> </div><div>....</div><div> </div><div> <security-domain name="my-security-domain" cache-type="default"><br>
<authentication><br> <login-module code="Remoting" flag="optional"><br> <module-option name="password-stacking" value="useFirstPass"/><br>
</login-module><br> <login-module code="RealmUsersRoles" flag="required"><br> <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/><br>
<module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/><br> <module-option name="realm" value="ApplicationRealm"/><br>
<module-option name="password-stacking" value="useFirstPass"/><br> </login-module><br> </authentication><br> </security-domain></div>
<div> </div><div>-------------------------------------------------------------------------------------------------------------</div><div>application-roles.properties:</div><div><br clear="all">test123=aabdd69afca03e09fc05b7539c62818d</div>
<div>-------------------------------------------------------------------------------------------------------------</div><div>application-users.properties:</div><div> </div><div>test123=testrole</div><div>------------------------------------------------------------------------------------------------------------</div>
<div><div> </div><div>@Stateless(name = "wutong_test_hello")<br>@Clustered<br>@Remote(HellowWorldRemote.class)<br>@Local(HellowWorldLocal.class)<br>@SecurityDomain(value = "my-security-domain")<br>public class HellowWorldImpl implements HellowWorldRemote, HellowWorldLocal {</div>
<div> </div><div> @RolesAllowed(value = { "testrole" })<br> public String hello(String name) {<br> String ret = "hello: " + name +" , "+ctx.getCallerPrincipal().getName();<br> <a href="http://log.info" target="_blank">log.info</a>(ret + ",hashcode:" + hashCode());<br>
return ret;<br> }</div><div>}</div><div> </div><div> </div><div>----------------------------------------------------------------------------------------------------------------------------</div><div>public interface HellowWorldRemote { <br>
String hello(String name);<br>}</div><div> </div><div>----------------------------------------------------------------------------------------------------------------------------</div><div>public interface HellowWorldLocal {<br>
String hello(String name);<br>}</div></div><div> </div><div> </div><div> </div><div>=========================client side stuff below=================================</div><div>jboss-ejb-client.properties:</div><div> </div>
<div><a href="http://endpoint.name" target="_blank">endpoint.name</a>=my_end_point<br>remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false</div><div>remote.connections=default<br>remote.connection.default.host=127.0.0.1<br>
remote.connection.default.port=4447<br>remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=true</div><div>remote.connection.default.username=test123<br>remote.connection.default.password=test</div>
<div><br>remote.clusters=ejb</div><div>remote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=true<br>remote.cluster.ejb.username=test123<br>remote.cluster.ejb.password=test</div><div> </div><div>------------------------------------------------------------------------------------------------</div>
<div> </div><div> Properties props = new Properties();<br> props.put(Context.URL_PKG_PREFIXES,"org.jboss.ejb.client.naming");<br> context = new InitialContext(props);</div><div> </div><div> <br> HellowWorldRemote remo=(HellowWorldRemote)context.lookup("ejb:/testEJB//wutong_test_hello!com.biz.ejb.face.HellowWorldRemote", HellowWorldRemote.class);<br>
<a href="http://log.info" target="_blank">log.info</a>(remo.hello(Long.toString(System.currentTimeMillis())));</div><div> </div><div> </div><div>------------------------------------------------------------------------------------------------</div>
<div> </div><div>I always get the following exception stacks bath on server side and client side :</div><div> </div><div> </div><div>16:58:53,157 ERROR [org.jboss.ejb3.invocation] (EJB default - 2) JBAS014134: EJB Invocation failed on component wutong_test_hello for method public abstract java.lang.String com.biz.ejb.face.HellowWorldRemote.hello(java.lang.String): javax.ejb.EJBAccessException: JBAS014502: Invocation on method: public abstract java.lang.String com.biz.ejb.face.HellowWorldRemote.hello(java.lang.String) of bean: wutong_test_hello is not allowed<br>
at org.jboss.as.ejb3.security.AuthorizationInterceptor.processInvocation(AuthorizationInterceptor.java:101) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]<br> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]<br>
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:76) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]<br> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]<br>
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]<br> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]<br>
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]<br> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]<br>
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]<br> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]<br>
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]<br> at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]<br>
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:300) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]<br> at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$200(MethodInvocationMessageHandler.java:64) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]<br>
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:194) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]<br> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_25]<br>
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_25]<br> at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_25]<br> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25]<br>
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25]<br> at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]<br> at org.jboss.threads.JBossThread.run(JBossThread.java:122)</div>
<div><br> the principal name from org.jboss.as.security.service.SimpleSecurityManager.getCallerPrincipal() is "$local" ,so that I doubt I did not pass username "test123" to remote server successfully....</div>
<div> </div><div>any idea what is wrong ? or what configuration files did I miss ?</div><div> </div><div>thank you very much</div>