@Test public void testAddKey() { 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())); secretManager.addKey(authKey); keys = secretManager.getKeys(); assertNotNull(keys); assertEquals(1, keys.size()); assertEquals(authKey, Iterables.getOnlyElement(keys.values())); }
public synchronized void addKey(AuthenticationKey key) { requireNonNull(key); log.debug("Adding AuthenticationKey with keyId {}", key.getKeyId()); allKeys.put(key.getKeyId(), key); if (currentKey == null || key.getKeyId() > currentKey.getKeyId()) { currentKey = key; } }
AuthenticationTokenSecretManager extends SecretManager<AuthenticationTokenIdentifier> { public synchronized void addKey(AuthenticationKey key) { requireNonNull(key); log.debug("Adding AuthenticationKey with keyId {}", key.getKeyId()); allKeys.put(key.getKeyId(), key); if (currentKey == null || key.getKeyId() > currentKey.getKeyId()) { currentKey = key; } } }
AuthenticationTokenSecretManager extends SecretManager<AuthenticationTokenIdentifier> { public synchronized void addKey(AuthenticationKey key) { requireNonNull(key); log.debug("Adding AuthenticationKey with keyId {}", key.getKeyId()); allKeys.put(key.getKeyId(), key); if (currentKey == null || key.getKeyId() > currentKey.getKeyId()) { currentKey = key; } } AuthenticationTokenSecretManager(String instanceID, long tokenMaxLifetime); }
AuthenticationTokenSecretManager extends SecretManager<AuthenticationTokenIdentifier> { public synchronized void addKey(AuthenticationKey key) { requireNonNull(key); log.debug("Adding AuthenticationKey with keyId {}", key.getKeyId()); allKeys.put(key.getKeyId(), key); if (currentKey == null || key.getKeyId() > currentKey.getKeyId()) { currentKey = key; } } 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> { public synchronized void addKey(AuthenticationKey key) { requireNonNull(key); log.debug("Adding AuthenticationKey with keyId {}", key.getKeyId()); allKeys.put(key.getKeyId(), key); if (currentKey == null || key.getKeyId() > currentKey.getKeyId()) { currentKey = key; } } 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);  }