I am building a user registration form. I have POST endpoint for registration and I am able to successfully register.
I have another endpoint called /invalid-token which is also mappped to POST mapping. I have added both of the endpoints to permitAll rules as below:
http.authorizeRequests() .antMatchers( "/register", "/confirm", "/invalid-token", "/registration-success") .permitAll() .anyRequest() .authenticated(); When I make a POST request to the invalid-token from the browser, I am getting a 403. I am not understanding where I am going wrong.
Response Status: General: Request URL: http://localhost:8081/invalid-token Request Method: POST Status Code: 403 Remote Address: [::1]:8081 Referrer Policy: no-referrer-when-downgrade Cache-Control: no-cache, no-store, max-age=0, must-revalidate Content-Length: 0 Date: Tue, 23 Apr 2019 05:14:30 GMT Expires: 0 Pragma: no-cache X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block
http.csrf().disable();? If it works, consider adding a token to production, disabling it is only for checking, dev.../registerendpoint working even withoutcsrfdisabledregisterendpoint and not for/invalid-tokenendpoint with disabledcsrf.