0 Replies Latest reply on Nov 7, 2014 1:49 PM by mattdurst

    Remote JNDI with Certificate Authentication.

    mattdurst

      My project is converting from Weblogic to Wildfly. So far I've been able to find information to figure out most issues, but I've come across one that has me stumped. Our application allows users to authenticate using a certificate or a username and password. All of this is working fine for users that are connecting to the application via a web browser. The issue I'm having is creating a remote connection with a certificate as the authentication credentials. I can create a context, do a lookup, and invoke EJBs without any issues if I set remote.connection.https.username and remote.connection.https.password and authenticate using these values. The problem I have is I can't figure out how to pass a certificate instead of a username and password for authentication. With Weblogic there was an Environment class that came with the client jar that allowed the client to pass in a certificate. The code looked like:

       

              Environment env = new Environment();
              env.setProviderUrl("t3s://hostname:port");
              InputStream key = new FileInputStream("pathTo/key.pem");
              InputStream cert = new FileInputStream("pathTo/cert.pem");
            
              key = new PEMInputStream(key);
              cert = new PEMInputStream(cert);

       

              env.setSSLClientCertificate(new InputStream[] { key, cert});
              env.setSSLClientKeyPassword("storePassword");

       

              env.setInitialContextFactory(Environment.DEFAULT_INITIAL_CONTEXT_FACTORY);
              context = env.getInitialContext();

       

      I have been unable to find something similar for Wildfly. Is there a way to do this with Wildfly?