code: static Subject createSubject(final SubjectFactory subjectFactory, final String domain)
     {
        if (System.getSecurityManager() == null)
           return subjectFactory.createSubject(domain);
  
        return AccessController.doPrivileged(new PrivilegedAction<Subject>() 
        {
           public Subject run()
           {
              return subjectFactory.createSubject(domain);
           }
        });
     }
docs: Get a Subject instance
  @param subjectFactory The subject factory
  @param domain The domain
  @return The instance