code: @Override
      public Principal getCurrentPrincipal() {
          Principal principal = null;
  
          // Get hold of the current subject
          Subject subject = null;
          try {
              subject = WSSubject.getCallerSubject();
              if (tc.isDebugEnabled()) {
                  Tr.debug(tc, "Current subject: ", subject);
              }
          } catch (WSSecurityException e) {
              if (tc.isDebugEnabled()) {
                  Tr.debug(tc, "Failed to get current subject", e);
              }
          }
  
          // If we have a subject, extract the first principal
          if (subject != null) {
              Set<Principal> principals = subject.getPrincipals();
              if (tc.isDebugEnabled()) {
                  Tr.debug(tc, "Number of principals: ", principals.size());
              }
              if (!principals.isEmpty()) {
                  principal = principals.iterator().next();
              }
          }
  
          return principal;
      }
docs: {@inheritDoc}