[jboss-dev-forums] [JBoss AS 7 Development] - Re: Remote client access with database login module: user name and password are UUIDs

Sebastian Bayerlein do-not-reply at jboss.com
Wed Mar 7 03:06:51 EST 2012


Sebastian Bayerlein [https://community.jboss.org/people/sebbay] created the discussion

"Re: Remote client access with database login module: user name and password are UUIDs"

To view the discussion, visit: https://community.jboss.org/message/722027#722027

--------------------------------------------------------------
Hello,
I'm facing the same problem. In the client I use a LoginContext to pass the username/password to the context:

final Properties jndiProperties = new Properties();

jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");

jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");       


InitialContext context = null;


try
{
          Configuration.setConfiguration ( new LoginConfiguration ());
          Class<?> cb = Class.forName ( "org.jboss.security.auth.callback.UsernamePasswordHandler" );
          Constructor<?> c = cb.getConstructor ( new Class[] { String.class, char[].class });
          LoginContext lc = new LoginContext ( "other", ( CallbackHandler ) c.newInstance ( new Object[] { "fapiuser", "guest".toCharArray() }));
          lc.login();

          context = new InitialContext(jndiProperties);

          EJBObject ejbObject = (EJBObject) context.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName);
          System.out.println("remote: " + ejbObject);

          ...

On server-side I use a custom login module:

public class CustomLoginModule extends UsernamePasswordLoginModule {


          protected String getUsersPassword() throws LoginException
  {
    final String username = super.getUsername();
    log.info( ">>> username: '" + username + "'" );
                    ...
          }
}

In JBoss logfile I also see the user name as a random UUID. Can somebody help me to solve this problem?


Regards,
Sebastian
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/722027#722027]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120307/f2977509/attachment.html 


More information about the jboss-dev-forums mailing list