private String getClientPrincipalName ( ) { final Set < Principal > principalSet = loginContext . getSubject ( ) . getPrincipals ( ) ; if ( principalSet . size ( ) != 1 ) throw new IllegalStateException ( "Only one principal is expected. Found 0 or more than one principals :" + principalSet ) ; return principalSet . iterator ( ) . next ( ) . getName ( ) ; }
This method is responsible for getting the client principal name from the subject s principal set