-
1. Re: Encoded username & password in custom server login module JBoss 7.1 CR1 (Picketbox 4.0.6)
sebbay Mar 6, 2012 10:21 AM (in response to snelders)Hello Jan,
Have you found a solution for this? I'm facing the same problem.
Regards,
Sebastian
-
2. Re: Encoded username & password in custom server login module JBoss 7.1 CR1 (Picketbox 4.0.6)
snelders Mar 6, 2012 3:42 PM (in response to sebbay)No unfortunately I havent seen an answer for a solution to this problem.
I concluded that this just wasn't implemented yet and waited for a fix for bug AS7-2999. Although the JIRA reports that this should be fixed in JBoss 7.1 Final it still doesn't work for me.
I posted the same problem on the JBoss forum which showed some activity yesterday: https://community.jboss.org/message/721598#721598 Hopefully someone will tell us all soon how this exactly works.
Best regards,
Jan Snelders
-
3. Re: Encoded username & password in custom server login module JBoss 7.1 CR1 (Picketbox 4.0.6)
sebbay Mar 7, 2012 3:10 AM (in response to snelders)This is the code I'm using. In the client I implemented 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.
Regards,
Sebastian