code: static Set<PasswordCredential> getPasswordCredentials(final Subject subject)
     {
        if (System.getSecurityManager() == null)
           return subject.getPrivateCredentials(PasswordCredential.class);
  
        return AccessController.doPrivileged(new PrivilegedAction<Set<PasswordCredential>>() 
        {
           public Set<PasswordCredential> run()
           {
              return subject.getPrivateCredentials(PasswordCredential.class);
           }
        });
     }
docs: Get the PasswordCredential from the Subject
  @param subject The subject
  @return The instances