...
Code Block |
---|
Properties p = new Properties(); p.put("java.naming.factory.initial", "org.apache.openejb.client.LocalInitialContextFactory"); InitialContext ctx = new InitialContext(p); MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote"); |
Local Client (non-default realm name)
Login configuration file (conf/login.config)
Code Block |
---|
PropertiesLogin {
org.apache.openejb.core.security.jaas.PropertiesLoginModule required
Debug=true
UsersFile="users.properties"
GroupsFile="groups.properties";
};
MyApp {
org.apache.openejb.core.security.jaas.SQLLoginModule required
dataSourceName="MyDataSource"
userSelect="SELECT username, password FROM users WHERE username=?"
groupSelect="SELECT username, grp FROM users WHERE username=?";
};
|
Program code
Code Block |
---|
Properties p = new Properties();
p.put("java.naming.factory.initial", "org.apache.openejb.client.LocalInitialContextFactory");
p.put("openejb.authentication.realmName", "MyApp");
InitialContext ctx = new InitialContext(p);
MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");
|
Remote Client (openejb standalone)
...