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 ) ; } } ) ; }
Get the PasswordCredential from the Subject