private String getCallerUniqueName ( ) throws WIMApplicationException { String uniqueName = null ; Subject subject = null ; WSCredential cred = null ; try { /* Get the subject */ if ( ( subject = WSSubject . getRunAsSubject ( ) ) == null ) { subject = WSSubject . getCallerSubject ( ) ; } /* Get the credential */ if ( subject != null ) { Iterator < WSCredential > iter = subject . getPublicCredentials ( WSCredential . class ) . iterator ( ) ; if ( iter . hasNext ( ) ) { cred = iter . next ( ) ; } } /* Get the unique name */ if ( cred == null ) return null ; else uniqueName = cred . getUniqueSecurityName ( ) ; } //throw exception in case there is some issue while retrieving authentication details from subject catch ( Exception excp ) { excp . getMessage ( ) ; return null ; } //return unique name obtained from subject return uniqueName ; }
Helper function returns the caller s unique name . Created to use for logging the calls to clear cache with clearAll mode .