/** Map the argument principal from the deployment environment principal to the developer environment. This is called by the EJB context getCallerPrincipal() to return the Principal as described by the EJB developer domain. @return a Principal object that is valid in the deployment environment if one exists. If no Subject exists or the Subject has no principals then the argument principal is returned. */ public Principal getPrincipal(Principal principal) { if(domainCache == null) return principal; Principal result = principal; // Get the CallerPrincipal group member synchronized( domainCache ) { DomainInfo info = getCacheInfo(principal, false); if( trace ) log.trace("getPrincipal, cache info: "+info); if( info != null ) { result = info.callerPrincipal; // If the mapping did not have a callerPrincipal just use principal if( result == null ) result = principal; info.release(); } } return result; }
DomainInfo cacheInfo = getCacheInfo(principal, true); if( trace ) log.trace("Begin isValid, principal:"+principal+", cache info: "+cacheInfo);