public boolean contain ( OidcTokenImplBase token ) { //(IdToken token) { String key = token . getJwtId ( ) ; if ( key == null ) { return false ; } key = getCacheKey ( token ) ; long currentTimeMilliseconds = ( new Date ( ) ) . getTime ( ) ; synchronized ( primaryTable ) { Long exp = ( Long ) primaryTable . get ( key ) ; // milliseconds if ( exp != null ) { if ( exp . longValue ( ) > currentTimeMilliseconds ) { // not expired yet // milliseconds return true ; } else { primaryTable . remove ( key ) ; } } // cache the jwt long tokenExp = token . getExpirationTimeSeconds ( ) * 1000 ; // milliseconds if ( tokenExp == 0 ) { // in case it's not set, let's give it one hour tokenExp = currentTimeMilliseconds + 60 * 60 * 1000 ; // 1 hour } primaryTable . put ( key , Long . valueOf ( tokenExp ) ) ; } return false ; }
Find and return the object associated with the specified key . Add it if not already present .