0 Replies Latest reply on Jan 7, 2018 2:43 PM by massimo amato

    wildfly 9.0.2 http-remoting/jndi not working on secured ejb

    massimo amato Newbie

      hi everybody

      i've spent the lat two days searching, studying and testing but with no success

       

      i've a simple ejb stateless bean in a sample application maked as

       

      @Stateless

      @SecurityDomain("myRealm")

      public class WebFacadeBean implements WebFacadeBeanRemote, WebFacadeBeanLocal {

       

      and "myRealm" is defined into standalone.xml as

       

                      <security-domain name="myRealm" cache-type="default">

                          <authentication>

                              <login-module code="Database" flag="sufficient">

                                  <module-option name="dsJndiName" value="java:jboss/datasources/myCore"/>

                                  <module-option name="principalsQuery" value="SELECT login FROM TB_Users WHERE login = ?"/>

                                  <module-option name="rolesQuery" value="SELECT role, 'Roles' FROM TB_Roles WHERE login = ?"/>

                              </login-module>

                          </authentication>

                      </security-domain>

       

      i'm trying to call a "testMethod" on my bean using both http-remoting or jndi

      i'm able to lookup the interface, but when i call the "testMethod" (debugging DatabaseServerLoginModule) the password is always

           org.jboss.as.security.remoting.RemotingConnectionCredential@xxxx

       

      if i remove the @SecurityDomain annotation it works fine

       

      my sample code is:

       

       

        String serverUrl = "http-remoting://localhost:8080";

       

        Hashtable<String, Object> params = new Hashtable<String, Object>();

        params.put(Context.PROVIDER_URL, serverUrl);

        params.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

        params.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

        params.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");

        params.put(Context.SECURITY_PRINCIPAL, "test");

        params.put(Context.SECURITY_CREDENTIALS, "test");

       

        Properties clientProp = new Properties();

        clientProp.put("remote.connections", "default");

        clientProp.put("remote.connection.default.host", "localhost");

        clientProp.put("remote.connection.default.port", "8080");

        clientProp.put("remote.connection.default.username", "test");

        clientProp.put("remote.connection.default.password", "test");

        clientProp.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");

       

        EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(clientProp);

        ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);

        EJBClientContext.setSelector(selector);

       

        InitialContext context = new InitialContext(params);

        String lookupName = "app/appEJB/WebFacadeBean!com.test.ejb.client.WebFacadeBeanRemote";

       

        WebFacadeBeanRemote facade = (WebFacadeBeanRemote) context.lookup(lookupName);

        facade.testMethod();

       

       

      anyone can help me?

       

      thank!!