@Test void getAllPublicKeys() { Map<String, String> allPublicKeys = publicKeyCacheService.getAllPublicKeys(); assertThat(3, is(allPublicKeys.size())); assertThat(allPublicKeys.get(SOME_REALM), is(datPublicKey)); assertThat(allPublicKeys.containsKey("REALM"), is(true)); assertThat(allPublicKeys.containsKey("REALM_SK"), is(true)); }
@Override public Map<String, String> getAllPublicKeys() { String pattern = keyPattern + "*"; logger.info("Trying to load public keys by pattern `{}`", pattern); Collection<String> keys = redisTemplate.keys(pattern); ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(keys.size()); for (String key : keys) { String pk = redisTemplate.opsForValue().get(key); logger.debug("Key={}, Value={}", key, pk); map.put(key.replace(keyPattern, ""), pk); } logger.info("{} public keys were founded", map.size()); return map; }
RealmPublicKeyCacheServiceImpl implements RealmPublicKeyCacheService { @Override public Map<String, String> getAllPublicKeys() { String pattern = keyPattern + "*"; logger.info("Trying to load public keys by pattern `{}`", pattern); Collection<String> keys = redisTemplate.keys(pattern); ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(keys.size()); for (String key : keys) { String pk = redisTemplate.opsForValue().get(key); logger.debug("Key={}, Value={}", key, pk); map.put(key.replace(keyPattern, ""), pk); } logger.info("{} public keys were founded", map.size()); return map; } }
RealmPublicKeyCacheServiceImpl implements RealmPublicKeyCacheService { @Override public Map<String, String> getAllPublicKeys() { String pattern = keyPattern + "*"; logger.info("Trying to load public keys by pattern `{}`", pattern); Collection<String> keys = redisTemplate.keys(pattern); ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(keys.size()); for (String key : keys) { String pk = redisTemplate.opsForValue().get(key); logger.debug("Key={}, Value={}", key, pk); map.put(key.replace(keyPattern, ""), pk); } logger.info("{} public keys were founded", map.size()); return map; } RealmPublicKeyCacheServiceImpl(String keyPattern, RedisTemplate<String, String> redisTemplate); }
RealmPublicKeyCacheServiceImpl implements RealmPublicKeyCacheService { @Override public Map<String, String> getAllPublicKeys() { String pattern = keyPattern + "*"; logger.info("Trying to load public keys by pattern `{}`", pattern); Collection<String> keys = redisTemplate.keys(pattern); ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(keys.size()); for (String key : keys) { String pk = redisTemplate.opsForValue().get(key); logger.debug("Key={}, Value={}", key, pk); map.put(key.replace(keyPattern, ""), pk); } logger.info("{} public keys were founded", map.size()); return map; } RealmPublicKeyCacheServiceImpl(String keyPattern, RedisTemplate<String, String> redisTemplate); void put(String key, String value); @Override String getPublicKeyByRealm(String realm); @Override Map<String, String> getAllPublicKeys(); }
RealmPublicKeyCacheServiceImpl implements RealmPublicKeyCacheService { @Override public Map<String, String> getAllPublicKeys() { String pattern = keyPattern + "*"; logger.info("Trying to load public keys by pattern `{}`", pattern); Collection<String> keys = redisTemplate.keys(pattern); ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(keys.size()); for (String key : keys) { String pk = redisTemplate.opsForValue().get(key); logger.debug("Key={}, Value={}", key, pk); map.put(key.replace(keyPattern, ""), pk); } logger.info("{} public keys were founded", map.size()); return map; } RealmPublicKeyCacheServiceImpl(String keyPattern, RedisTemplate<String, String> redisTemplate); void put(String key, String value); @Override String getPublicKeyByRealm(String realm); @Override Map<String, String> getAllPublicKeys();  }