Skip to content

Commit

Permalink
fix the issue that access key doesn't work if appid passed is in diff…
Browse files Browse the repository at this point in the history
…erent case (apolloconfig#3627)
  • Loading branch information
nobodyiam authored Apr 7, 2021
1 parent 943bbb4 commit 32a2a97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void initialize() {
ApolloThreadFactory.create("AccessKeyServiceWithCache", true));
lastTimeScanned = new Date(0L);

ListMultimap<String, AccessKey> multimap = ListMultimapBuilder.hashKeys(128)
ListMultimap<String, AccessKey> multimap = ListMultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER)
.arrayListValues().build();
accessKeyCache = Multimaps.synchronizedListMultimap(multimap);
accessKeyIdCache = Maps.newConcurrentMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public void testGetAvailableSecrets() throws Exception {

await().untilAsserted(() -> assertThat(accessKeyServiceWithCache.getAvailableSecrets(appId))
.containsExactly("secret-1", "secret-2"));
// should also work with appid in different case
assertThat(accessKeyServiceWithCache.getAvailableSecrets(appId.toUpperCase()))
.containsExactly("secret-1", "secret-2");
assertThat(accessKeyServiceWithCache.getAvailableSecrets(appId.toLowerCase()))
.containsExactly("secret-1", "secret-2");

// Update access key, disable the first one
firstAccessKey = assembleAccessKey(1L, appId, "secret-1", false, false, 1577808004000L);
Expand Down

0 comments on commit 32a2a97

Please sign in to comment.