public boolean isValid ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Checking validity of token " + this . getClass ( ) . getName ( ) ) ; if ( token != null ) { // return if this token is still valid long currentTime = System . currentTimeMillis ( ) ; long expiration = getExpiration ( ) ; long timeleft = expiration - currentTime ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Time left for token: " + timeleft ) ; if ( timeleft > 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "token is valid." ) ; return true ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "token is invalid." ) ; return false ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "token is null, returning invalid." ) ; return false ; } }
Validates the token including expiration signature etc .