Closed
Description
Related to #6945
It would be nice if an application could indicate a custom claim name for GrantedAuthority
s without creating a custom converter.
Something like:
JwtGrantedAuthoritiesConverter converter = new JwtGrantedAuthoritiesConverter();
converter.setAuthoritiesClaimName("authorities");
Would be easier to do than:
Converter<Jwt, List<GrantedAuthorities>> converter = jwt -> {
List<String> authorities = (List<String>) jwt.getClaim("authorities");
return authorities.stream()
.map(authority -> "SCOPE_" + authority)
.map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
};
So, let's add a setter to JwtGrantedAuthoritiesConverter
called setAuthoritiesClaimName
so that the converter knows which claim to look for.