[jboss-user] [Security & JAAS/JBoss] - Cannot get my custom principal returned by sessioncontext.ge

dweil do-not-reply at jboss.com
Thu Jul 20 14:53:45 EDT 2006


We use a custom login module. It is not derived from UsersRolesLoginModule for various reasons.

We try to register our custom principal as caller principal by creating a group called 'CallerPrincipal', adding our custom principal to it. Nevertheless getCallerPrincipal in EJBs returns the default principal of type org.jboss.security.SimplePrincipal.

This is the code of the login module:


  |   public boolean login() throws LoginException {
  |     ...
  |     this.subjectPrincipals = new HashSet();
  |     MyPrincipal myPrincipal = new MyPrincipal(principalName);
  |     this.subjectPrincipals.add(myPrincipal);
  | 
  |     Group callerPrincipalGroup = new MyGroup("CallerPrincipal");
  |     callerPrincipalGroup.addMember(myPrincipal);
  |     this.subjectPrincipals.add(callerPrincipalGroup);
  | 
  |     Group roles = new MyGroup("Roles");
  |     ... // Fill in roles
  |     this.subjectPrincipals.add(roles);
  |     ...
  |   }
  | 
  |   public boolean commit() throws LoginException {
  |     this.subject.getPrincipals().addAll(this.subjectPrincipals);
  |     return true;
  |   }
  | 

What is wrong? How can I get the principal created by new MyPrincipal(...) as return value of ejbContext.getCallerPrincipal()?

Thank you!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959670#3959670

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959670



More information about the jboss-user mailing list