code: public static String getCallerPrincipal() {
          String caller = null;
          SubjectManagerService sms = smServiceRef.getService();
          if (sms != null) {
              Subject subject = sms.getCallerSubject();
              if (subject != null) {
  
                  WSCredential wsCred = getWSCredential(subject);
  
                  if (wsCred != null && !wsCred.isUnauthenticated()) {
                      try {
                          caller = wsCred.getSecurityName();
                      } catch (Exception e) {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                              Tr.debug(tc, "Internal error: " + e);
                      }
                  }
              }
          }
          return caller;
      }
docs: <p>
  This convenient method returns the caller principal of the
  current executing thread.
  </p>
  
  <p>
  It will extract the caller from the received credentials of
  the current thread. If the received credentials is null, then
  a value of null is returned. In the EJB and Web container,
  user should use the standard interface provided by the J2EE
  specification to get the caller principal or caller name. This
  method call provides a way for code executing outside the
  containers to get the caller principal. The principal name
  return is not qualified with the security realm name.
  </p>
  
  @return The principal name (without the security realm). If the
  received credential is null, then the value of null will
  be returned as the caller principal.