Commit 68b9792e authored by Phillip Webb's avatar Phillip Webb

Fix FixedAuthoritiesExtractor map extract bug

Fix issue where FixedAuthoritiesExtractor would fail to obtain standard
item from the map because an incorrect key was used.

Fixes gh-6396
parent 5a941bb5
......@@ -79,7 +79,7 @@ public class FixedAuthoritiesExtractor implements AuthoritiesExtractor {
}
for (String key : AUTHORITY_KEYS) {
if (map.containsKey(key)) {
return map.get(map);
return map.get(key);
}
}
return map;
......
......@@ -75,8 +75,10 @@ public class FixedAuthoritiesExtractorTests {
@Test
public void authoritiesAsListOfMapsWithStandardKey() {
this.map.put("authorities",
Arrays.asList(Collections.singletonMap("role", "ROLE_ADMIN")));
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("role", "ROLE_ADMIN");
map.put("extra", "value");
this.map.put("authorities", Arrays.asList(map));
assertThat(this.extractor.extractAuthorities(this.map).toString())
.isEqualTo("[ROLE_ADMIN]");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment