- In jboss.xml, add <security-domain>java:/jaas/jboss-secure</security-domain>
- In JBoss install directorty, C:\jboss-4.2.1.GA\server\default\conf, add users.properties and roles.properties
- In users.properties, add user=pass
- In roles.properties, add user=role
- Deploy ejb, restart jboss
- In your ejb client, your initialContext should look like this
- properties.put(Context.INITIAL_CONTEXT_FACTORY , "org.jboss.security.jndi.JndiLoginInitialContextFactory");
properties.put("java.naming.provider.url", "jnp://localhost:1099");
properties.put(Context.SECURITY_PRINCIPAL, "user");
properties.put(Context.SECURITY_CREDENTIALS, "pass");
Context ic = new InitialContext(properties);
Or alternatively,
Application Server side:
NO CHANGES
EJB side:
- In jboss.xml add domain
- Add users.properties, roles.properties to ejb jar above META-INF