Hi, I learn the below way to customize the authority prefix and claim name. Would like to suggest provide configuration properties to allow developer to easily customize the JwtAuthenticationConverter.
@Bean
public JwtAuthenticationConverter jwtAuthenticationConverter() {
JwtGrantedAuthoritiesConverter grantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter();
grantedAuthoritiesConverter.setAuthorityPrefix("");
//grantedAuthoritiesConverter.setAuthoritiesClaimName("role");
JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter();
jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(grantedAuthoritiesConverter);
return jwtAuthenticationConverter;
}
Comment From: jzheaux
Hi, @hannah23280! Thanks for the suggestion. Configuration properties live in Spring Boot, so please consider filing an issue there and we can discuss it. Personally, I doubt that changing the authority prefix is common enough to merit a property, but I can see the claim name as a possibility.