@Test public void testRemoveKey() { long tokenLifetime = 60 * 1000; AuthenticationTokenSecretManager secretManager = new AuthenticationTokenSecretManager(instanceId, tokenLifetime); AuthenticationKey authKey = new AuthenticationKey(1, 0, tokenLifetime, keyGen.generateKey()); secretManager.addKey(authKey); Map<Integer,AuthenticationKey> keys = secretManager.getKeys(); assertNotNull(keys); assertEquals(1, keys.size()); assertEquals(authKey, Iterables.getOnlyElement(keys.values())); assertTrue(secretManager.removeKey(authKey.getKeyId())); assertEquals(0, secretManager.getKeys().size()); }
synchronized boolean removeKey(Integer keyId) { requireNonNull(keyId); log.debug("Removing AuthenticatioKey with keyId {}", keyId); return allKeys.remove(keyId) != null; }
AuthenticationTokenSecretManager extends SecretManager<AuthenticationTokenIdentifier> { synchronized boolean removeKey(Integer keyId) { requireNonNull(keyId); log.debug("Removing AuthenticatioKey with keyId {}", keyId); return allKeys.remove(keyId) != null; } }
AuthenticationTokenSecretManager extends SecretManager<AuthenticationTokenIdentifier> { synchronized boolean removeKey(Integer keyId) { requireNonNull(keyId); log.debug("Removing AuthenticatioKey with keyId {}", keyId); return allKeys.remove(keyId) != null; } AuthenticationTokenSecretManager(String instanceID, long tokenMaxLifetime); }
AuthenticationTokenSecretManager extends SecretManager<AuthenticationTokenIdentifier> { synchronized boolean removeKey(Integer keyId) { requireNonNull(keyId); log.debug("Removing AuthenticatioKey with keyId {}", keyId); return allKeys.remove(keyId) != null; } AuthenticationTokenSecretManager(String instanceID, long tokenMaxLifetime); @Override byte[] retrievePassword(AuthenticationTokenIdentifier identifier); @Override AuthenticationTokenIdentifier createIdentifier(); Entry<Token<AuthenticationTokenIdentifier>,AuthenticationTokenIdentifier> generateToken(String username, DelegationTokenConfig cfg); synchronized void addKey(AuthenticationKey key); synchronized void removeAllKeys(); static SecretKey createSecretKey(byte[] raw); }
AuthenticationTokenSecretManager extends SecretManager<AuthenticationTokenIdentifier> { synchronized boolean removeKey(Integer keyId) { requireNonNull(keyId); log.debug("Removing AuthenticatioKey with keyId {}", keyId); return allKeys.remove(keyId) != null; } AuthenticationTokenSecretManager(String instanceID, long tokenMaxLifetime); @Override byte[] retrievePassword(AuthenticationTokenIdentifier identifier); @Override AuthenticationTokenIdentifier createIdentifier(); Entry<Token<AuthenticationTokenIdentifier>,AuthenticationTokenIdentifier> generateToken(String username, DelegationTokenConfig cfg); synchronized void addKey(AuthenticationKey key); synchronized void removeAllKeys(); static SecretKey createSecretKey(byte[] raw);  }