*/
Principal getCallerPrincipalInternal()
{
if( beanPrincipal == null )
{
RealmMapping rm = con.getRealmMapping();
SecurityContext sc = SecurityActions.getSecurityContext();
Principal caller = null;
try
{
caller = SecurityHelperFactory.getEJBAuthorizationHelper(sc).getCallerPrincipal();
}
catch (Exception e)
{
log.error("Error getting callerPrincipal for " + con.getBeanClass(),e);
}
/* Apply any domain caller mapping. This should really only be
done for non-run-as callers.
*/
if (rm != null)
caller = rm.getPrincipal(caller);
if( caller == null )
{
/* Try the incoming request principal. This is needed if a client
clears the current caller association and and an interceptor calls
getCallerPrincipal as the call stack unwinds.
*/
if( principal != null )
{
if( rm != null )
caller = rm.getPrincipal(principal);
else
caller = principal;
}
// Check for an unauthenticated principal value
else