Когда я хочу настроить сервер ресурсов OAuth2 с токеном с токеном для носителя. /> Spring-Boot-Starter-OAuth2-Resource-Server
Spring-Boot-Starter-Security
Spring-Boot-Starter-Web
Spring-Security-OAuth2-jose < /p>
Я хочу настроить ресурсный сервер OAuth2 без весенней загрузки. (https://docs.spring.io/spring-security/ ... t-sansboot).
Какие бобы находятся помимо фильтрации и Jwtdecoder, чтобы создать авторизатор, который работает докенов platerchain и Jwtdecoder, чтобы установить, чтобы сапожник в токен работает? иначе настройка в следующем конфигурации, что ресурсный сервер OAuth2 работает на Spring 6 с Spring Security 6.5.1? < /p>
@Configuration
@EnableWebSecurity
public class SpringSecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests(authorize -> authorize
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2) -> oauth2.jwt(Customizer.withDefaults()));
return http.build();
}
@Bean
public JwtDecoder jwtDecoder() {
return JwtDecoders.fromIssuerLocation("http://192.168.120.59:8080/realms/ConnectTrial");
}
}
< /code>
Я хочу извлечь власти вручную с префиксом "role_". Это настраивается право на бон? Чего не хватает? < /P>
@Bean
public JwtAuthenticationConverter jwtAuthenticationConverter() {
JwtGrantedAuthoritiesConverter grantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter();
grantedAuthoritiesConverter.setAuthorityPrefix("ROLE_");
JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter();
jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(grantedAuthoritiesConverter);
return jwtAuthenticationConverter;
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... ith-oauth2