I have okta configured in my springboot application . But i want to autheticate with Okta With only one endpoint and not to all urls.
so i did this
@Configuration
class OktaOAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
// Require authentication for all requests under /api/private
.antMatchers("/loginOkta").authenticated()
.and()
.oauth2ResourceServer().jwt();
}
It works fine , and now i can call any other GET Requests without okta verfication , But all the Posts requests gives 403 forbidden erro .
I dont understand why All GET requests work but not POST Requests (which gives 403) whereas i mentioned in the code that only autheicate with okta ,with only one (above) url