code: @SuppressWarnings({ "unchecked", "rawtypes" })
      public static void setRunAsSubject(final Subject subject)
                      throws WSSecurityException {
          SecurityManager sm = System.getSecurityManager();
          if (sm != null) {
              sm.checkPermission(SETRUNASSUBJECT_PERM);
          }
          try {
              java.security.AccessController.doPrivileged(new PrivilegedExceptionAction() {
                  @Override
                  public Object run() throws WSSecurityException {
                      SubjectManagerService sms = smServiceRef.getService();
                      if (sms != null) {
                          sms.setInvocationSubject(subject);
                      }
                      return null;
  
                  }
              });
  
          } catch (PrivilegedActionException pae) {
              WSSecurityException e = (WSSecurityException) pae.getException();
              throw e;
          }
      }
docs: <p>
  This method set the Subject as the J2EE run as identity on the current execution thread.
  </p>
  
  <p>
  This method is protected by Java 2 Security. If Java 2 Security is enabled, then
  access will be denied if the application code is not granted the permission
  <code>javax.security.auth.AuthPermission("wssecurity.setRunAsSubject")</code>.
  </p>
  
  @no return value.
  @exception WSSecurityException
  failed to set the run as identity