I have been following tutorials on how to set up security with Springboot. Can someone explain to me what this line does:
.oauth2ResourceServer((oauth2) -> oauth2
.jwt(Customizer.withDefaults())
)
Does it just make sure the Bearer token is in JWT format? Or does it actually contact Google (I use it for log in) to verify the JWT token
It is located in: @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests(request -> request
.requestMatchers("/api/secure/**")
.authenticated()
.anyRequest().permitAll())
.oauth2ResourceServer((oauth2) -> oauth2
.jwt(Customizer.withDefaults())
)
.sessionManagement((session) ->
session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
.cors(Customizer.withDefaults()
);
http.csrf(csrf->csrf.disable());
return http.build();
}