With Glassfish realms and Context
I can use UserPrincipal.getName()
and isUserInRole
methods to retrieve information about the logged in user.
However, I need to share more data across the EJBs, e.g. information about the user I can get through database or LDAP (such as name, domain, etc...).
I'm not asking about how to retrieve this information, but I've been spending hours to find a good way to pass it across all the EJBs called in the Session/Request.
I've read about EJBContext.getContextData()
, but it seems that this property isn't propagated, and I can't use the stored values outside of the EJB that stored them. I've also read about implementing my own UserPrincipal, but I don't have a clue about how to do it for Glassfish, and keep using the glassfish default realm configurations.
I don't want to modify my EJBs signature to pass the information, but I can't think of another way of doing it properly.
Do you have any ideas?