Hello,
Now I am receiving a token generated in fronted (REACT) but I don’t know the way to validate that in Spring Boot configuration.
I tried with that code:
@Configuration
@EnableWebSecurity
public class SecurityConfig{
@Value("${spring.security.oauth2.resourceserver.jwt.issuer-uri}")
private String issuer;
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.cors(Customizer.withDefaults())
.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(authz -> {
authz.requestMatchers("/test/private").authenticated();
authz.anyRequest().permitAll();
}).oauth2ResourceServer((oauth2) -> oauth2
.jwt(Customizer.withDefaults())
);
return http.build();
}
@Bean
public JwtDecoder jwtDecoder() {
return JwtDecoders.fromIssuerLocation(issuer);
}
}
With that code I can use token generated using API APP but I can’t use token generated in auth code flow from React . Why?
Thanks you!