Saturday, April 5, 2014

JBoss EJB Lab

Followed: http://www.26miles.com/26miles/downloads/JBoss%205.0.1.GA/Simple%20Web%20Application%20using%20JBoss%20and%20Eclipse.doc

and http://www.26miles.com/26miles/downloads/JBoss%205.0.1.GA/Simple%20EJB%202.1%20Application%20using%20JBoss%20and%20Eclipse.doc
 in that order.

Used jboss-4.2.2.GA instead. and set up SimpleStandAloneClient per doc.

Once "SimpleSession" was working, copied target JAR to server\default\deploy

Changed string in context.lookup to match target ejb jndi (note if there's a jboss.xml in the jar as there was in this case, check it for actual jndi-name to use instead of ejb-name from ejb-jar.xml). Change properties passed to InitialContext as well.

Target's ejb-jar.xml contained an assembly-descriptor so need to configure security in client app.

Add:             System.setSecurityManager(new RMISecurityManager());
to top of of main right after opening of try block.

Instead of adding the credentials to the properties, use SecurityAssociation as follows (inserted before InitialContext context = new InitialContext(properties)

SecurityAssociation.setPrincipal(new SimplePrincipal("user"));
SecurityAssociation.setCredential("password");

Add roles.properties and user.properties files to server\default\conf containing security-role name corresponding to target ejb/method from ejb-jar.xml.

will need to execute it like java -Djava.security.policy=client.policy SimpleStandAloneClient
with client.policy containing e.g., for all permissions (ok only for lab):
grant {
permission java.security.AllPermission;
};


add server\default\deploy\oracle-ds.xml with security-domain info (see https://community.jboss.org/wiki/EncryptingDataSourcePasswords)
modify server\default\conf\login-config.xml
add ojdbc5.jar to server\default\lib

No comments:

Post a Comment