test_class.declarator: LOGGER = LoggerFactory.getLogger(TemporaryTokenCacheTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(TemporaryTokenCacheTest.class);
test_class.type: Logger
test_class.var_name: LOGGER
test_class.declarator: TOKEN = "some_token"
test_class.modifier: private static final
test_class.original_string: private static final String TOKEN = "some_token";
test_class.type: String
test_class.var_name: TOKEN
test_class.declarator: KEY = "some_key"
test_class.modifier: private static final
test_class.original_string: private static final String KEY = "some_key";
test_class.type: String
test_class.var_name: KEY
test_class.declarator: mockGenerator
test_class.modifier: private
test_class.original_string: private TokenGenerator mockGenerator;
test_class.type: TokenGenerator
test_class.var_name: mockGenerator
test_class.declarator: tokenCache
test_class.modifier: private
test_class.original_string: private TemporaryTokenCache tokenCache;
test_class.type: TemporaryTokenCache
test_class.var_name: tokenCache
test_class.file: guja-core/src/test/java/com/wadpam/guja/oauth2/provider/TemporaryTokenCacheTest.java
test_class.identifier: TemporaryTokenCacheTest
test_case.body: @Test
    public void testValidateToken() throws Exception {
  
      expect(mockGenerator.generate()).andReturn(TOKEN).once();
      replay(mockGenerator);
  
      String token = tokenCache.generateTemporaryToken(KEY, 10);
  
      assertFalse(tokenCache.validateToken("wrong_key", TOKEN));
      assertFalse(tokenCache.validateToken(KEY, "wrong_token"));
  
      assertTrue(tokenCache.validateToken(KEY, TOKEN));
      assertFalse(tokenCache.validateToken(KEY, TOKEN));
  
    }
test_case.class_method_signature: TemporaryTokenCacheTest.testValidateToken()
test_case.full_signature: @Test public void testValidateToken()
test_case.identifier: testValidateToken
test_case.invocations: once andReturn expect generate replay generateTemporaryToken assertFalse validateToken assertFalse validateToken assertTrue validateToken assertFalse validateToken
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidateToken()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(TemporaryTokenCache.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(TemporaryTokenCache.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: DEFAULT_TOKEN_DURATION_SECONDS = 60 * 60
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_TOKEN_DURATION_SECONDS = 60 * 60;
focal_class.type: int
focal_class.var_name: DEFAULT_TOKEN_DURATION_SECONDS
focal_class.declarator: tokenGenerator
focal_class.modifier: private final
focal_class.original_string: private final TokenGenerator tokenGenerator;
focal_class.type: TokenGenerator
focal_class.var_name: tokenGenerator
focal_class.declarator: tokenCache
focal_class.modifier: private final
focal_class.original_string: private final Cache<String, Triplet<String, Long, Object>> tokenCache;
focal_class.type: Cache<String, Triplet<String, Long, Object>>
focal_class.var_name: tokenCache
focal_class.file: guja-core/src/main/java/com/wadpam/guja/oauth2/provider/TemporaryTokenCache.java
focal_class.identifier: TemporaryTokenCache
focal_class.class_method_signature: TemporaryTokenCache.TemporaryTokenCache(TokenGenerator tokenGenerator, CacheBuilderProvider cacheBuilderProvider)
focal_class.full_signature: @Inject public  TemporaryTokenCache(TokenGenerator tokenGenerator, CacheBuilderProvider cacheBuilderProvider)
focal_class.identifier: TemporaryTokenCache
focal_class.modifiers: @Inject public
focal_class.parameters: (TokenGenerator tokenGenerator, CacheBuilderProvider cacheBuilderProvider)
focal_class.signature:  TemporaryTokenCache(TokenGenerator tokenGenerator, CacheBuilderProvider cacheBuilderProvider)
focal_class.class_method_signature: TemporaryTokenCache.generateTemporaryToken(String key, int secondsToLive)
focal_class.full_signature: public String generateTemporaryToken(String key, int secondsToLive)
focal_class.identifier: generateTemporaryToken
focal_class.modifiers: public
focal_class.parameters: (String key, int secondsToLive)
focal_class.return: String
focal_class.signature: String generateTemporaryToken(String key, int secondsToLive)
focal_class.class_method_signature: TemporaryTokenCache.generateTemporaryToken(String key, int secondsToLive, Object context)
focal_class.full_signature: public String generateTemporaryToken(String key, int secondsToLive, Object context)
focal_class.identifier: generateTemporaryToken
focal_class.modifiers: public
focal_class.parameters: (String key, int secondsToLive, Object context)
focal_class.return: String
focal_class.signature: String generateTemporaryToken(String key, int secondsToLive, Object context)
focal_class.class_method_signature: TemporaryTokenCache.validateToken(String key, String token)
focal_class.full_signature: public boolean validateToken(String key, String token)
focal_class.identifier: validateToken
focal_class.modifiers: public
focal_class.parameters: (String key, String token)
focal_class.return: boolean
focal_class.signature: boolean validateToken(String key, String token)
focal_class.class_method_signature: TemporaryTokenCache.validateTokenAndGetContext(String key, String token)
focal_class.full_signature: private Pair<Boolean, Object> validateTokenAndGetContext(String key, String token)
focal_class.identifier: validateTokenAndGetContext
focal_class.modifiers: private
focal_class.parameters: (String key, String token)
focal_class.return: Pair<Boolean, Object>
focal_class.signature: Pair<Boolean, Object> validateTokenAndGetContext(String key, String token)
focal_class.class_method_signature: TemporaryTokenCache.getContextForToken(String key, String token)
focal_class.full_signature: public Optional<Object> getContextForToken(String key, String token)
focal_class.identifier: getContextForToken
focal_class.modifiers: public
focal_class.parameters: (String key, String token)
focal_class.return: Optional<Object>
focal_class.signature: Optional<Object> getContextForToken(String key, String token)
focal_class.class_method_signature: TemporaryTokenCache.removeToken(String key)
focal_class.full_signature: public void removeToken(String key)
focal_class.identifier: removeToken
focal_class.modifiers: public
focal_class.parameters: (String key)
focal_class.return: void
focal_class.signature: void removeToken(String key)
focal_method.body: public boolean validateToken(String key, String token) {
      return validateTokenAndGetContext(key, token).first();
    }
focal_method.class_method_signature: TemporaryTokenCache.validateToken(String key, String token)
focal_method.full_signature: public boolean validateToken(String key, String token)
focal_method.identifier: validateToken
focal_method.invocations: first validateTokenAndGetContext
focal_method.modifiers: public
focal_method.parameters: (String key, String token)
focal_method.return: boolean
focal_method.signature: boolean validateToken(String key, String token)