There appears to be a bug in the CVS version of
EnterpriseContext.java. (I have not traced back to see when it was
introduced, or whether it has always been there.)
The problem is with what I believe is caching of "caller
principal". In the following code snippet...
public Principal getCallerPrincipal(){
if (principal == null &&
beanPrincipal == null && con.getRealMapping() != null){
beanPrincipal =
con.getRealmMapping().getPrincipal(principal);
}
return beanPrincipal;
}
This code avoids re-mapping the principal after the first call
to "getCallerPrincipal". However, the actual principal may
actually have changed. (New user calls the same bean.) However, the
original beanPrincipal is always returned.
Unless I am misunderstanding something, the
"beanPrincipal" should be cleared the next time "principal"
is changed in "setPrincipal( principal )". That way an updated
beanPrincipal is calculated every time principal changes.
I am making this change in my copy of
source. Please let me know if the current implementation is correct and
I'm mixed up.
Thanks,
- Keith
The code for