EJB Client Login
I found some difficulties in client login to access some ejb. I followed Mastering ejb 4th edition and tried to login but it didn't work and it consumed my number of days. But during that time I got some good knowledge on JAAS and Some Of ways to login is desribed here.
1) Using JndiLoginInitialContextFactory
This is simple add following properites to java env.
java.naming.factory.initial=org.jboss.security.jndi.JndiLoginInitialContextFactory
java.naming.security.principal=admin
java.naming.security.credentials=admin
2) Using SecurityClient
SecurityClient client = SecurityClientFactory.getSecurityClient();
client.setSimple("admin", "admin");
client.login();
3) The way I said I couldn't
Finally I was able to login as mentioned in Mastering ejb book. only thing that missed was some configuratin. after I adding that configuration, It started to work fine.
Configuration conf = new Configuration() {
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
AppConfigurationEntry entry = new AppConfigurationEntry("org.jboss.security.ClientLoginModule",AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, new java.util.HashMap());
return new AppConfigurationEntry[] {entry};
}
};
LoginContext loginContext =
new LoginContext("HelloClient",null, new CallbackHandler(), null);
loginContext.login();
Reference
http://blog.e-beyond.de/2010/04/18/jaas-jboss-client-authentication/
Labels: EJB Client Login


0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home