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
This commit is contained in:
parent
5a941bb5a5
commit
68b9792ed6
|
|
@ -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]");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue