I would like to know how to have both access to my endpoint api with Google(oauth2login) and with JWT (using oauth2ressourceServe)
I already implement solution to access with jwt using the oauth2RessourceServer who validate my token
public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {
return httpSecurity
.authorizeHttpRequests(requests-> requests
.requestMatchers(requestMatchers).permitAll()
.anyRequest().authenticated())
.sessionManagement(sm->sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.headers(hs -> hs.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
.cors(Customizer.withDefaults())
.csrf(getCsrfConfigurerCustomizer())
.oauth2ResourceServer(oauth2->oauth2.jwt(Customizer.withDefaults()))
.build();
}
And now i don't know how to add oauth2login, because all request will be blocked by oauth2RessourceServer because i don't send jwt as expected by : .oauth2ResourceServer(oauth2->oauth2.jwt(Customizer.withDefaults()))
thanks