@ Override @ FFDCIgnore ( { CredentialDestroyedException . class , CredentialExpiredException . class } ) public boolean isSubjectValid ( Subject subject ) { boolean valid = false ; try { WSCredential wsCredential = getWSCredential ( subject ) ; if ( wsCredential != null ) { long credentialExpirationInMillis = wsCredential . getExpiration ( ) ; Date currentTime = new Date ( ) ; Date expirationTime = new Date ( credentialExpirationInMillis ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Current time = " + currentTime + ", expiration time = " + expirationTime ) ; } if ( credentialExpirationInMillis == 0 || credentialExpirationInMillis == - 1 || currentTime . before ( expirationTime ) ) { valid = true ; } } } catch ( CredentialDestroyedException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "CredentialDestroyedException while determining the validity of the subject." , e ) ; } } catch ( CredentialExpiredException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "CredentialExpiredException while determining the validity of the subject." , e ) ; } } return valid ; }
Checks if the subject is valid . Currently a subject is REQUIRED to have a WSCredential and it is only valid if the WSCredential is not expired .