In an EJB project, I need to replace the name of the main call in "javax.ejb.SessionContext". I am using Jboss AS 6.0 Final as an application server.
I have defined a custom UserLoginModule that extends UsernamePasswordLoginModule and adds a user principle, but my user principle will not propagate in the EJB SessionContext.
Here is the code from my user login module:
@Override protected Group[] getRoleSets() throws LoginException { Group[] groups = new Group[2]; groups[0] = new SimpleGroup("Roles"); groups[0].addMember(createRoleIdentity()); Group callerPrincipal = new SimpleGroup("CallerPrincipal"); callerPrincipal.addMember(createIdentity(this.getUsername())); groups[1] = callerPrincipal; subject.getPrincipals().add(callerPrincipal); return groups; } @Override protected Principal createIdentity(String username) throws LoginException { return new MyCustomPrincipal(username); } }
My user login module works fine, but the main caller I get from "javax.ejb.SessionContext" is still SimplePrincipal.
It turned out that there is a Jobss error: EJBContext.getCallerPrincipal () does not return the user main https://issues.jboss.org/browse/JBAS-8427
And related topic: http://community.jboss.org/thread/44388 .
I wonder if you have some experience with this issue and is it safe to replace the main Jboss project? Are there any side effects?
source share