关于Spring GateWay OAuth2ResourceServer 配置ServerHttpSecurity中的hasRole 无...
我知道从security升级到5.2.X版本之后配置 jwtAuthenticationConverter这个可以解决,但是我现在的security版本为5.1.8,没有JwtGrantedAuthoritiesConverter这个类,而且我这个整体还不能升级,要怎么配置呢5.2以上版本这样配置,但是我现在这个版本要怎么弄呢,cloud版本为Greenwitch.SR6
@Bean
public Converter<Jwt, ? extends Mono<? extends AbstractAuthenticationToken>> jwtAuthenticationConverter() {
JwtGrantedAuthoritiesConverter jwtGrantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter();
jwtGrantedAuthoritiesConverter.setAuthorityPrefix(AuthConstants.AUTHORITY_PREFIX);
jwtGrantedAuthoritiesConverter.setAuthoritiesClaimName(AuthConstants.JWT_AUTHORITIES_KEY);
JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter();
jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(jwtGrantedAuthoritiesConverter);
return new ReactiveJwtAuthenticationConverterAdapter(jwtAuthenticationConverter);
}
https://blog.csdn.net/qq_24230139/article/details/105091273看看这个 手工模拟写个类似的可以不 https://blog.csdn.net/qq_24230139/article/details/105091273 参考下这个 感觉是哪里没有配置对吧
页:
[1]