Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom Principal won't be propagated to EJB SessionContext on Jboss AS
    text
    copied!<p>In a EJB project, I need to replace the call princial name in "javax.ejb.SessionContext". I use Jboss AS 6.0 Final as the application server.</p> <p>I defined a custom UserLoginModule that extends UsernamePasswordLoginModule and added a custom principal, but my custom principal won't be propagated to EJB SessionContext.</p> <p>Here is some code from my custom login module:</p> <pre><code>@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); } } </code></pre> <p>My custom login module works well, but the caller principal I get from "javax.ejb.SessionContext" is still SimplePrincipal.</p> <p>It turned out that there is a Jobss bug: EJBContext.getCallerPrincipal() is not returning custom principal <a href="https://issues.jboss.org/browse/JBAS-8427" rel="nofollow">https://issues.jboss.org/browse/JBAS-8427</a></p> <p>And a related topic: <a href="http://community.jboss.org/thread/44388" rel="nofollow">http://community.jboss.org/thread/44388</a>. </p> <p>I wonder if you have some experiences on this and is it safe to replace the default principal Jboss creates? Are ther any side effects? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload