I am trying to set up HttpSecurity in Spring 6.1.2 and I need to add jwtEntrypoint to it but I discovered
protected void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable();
http.exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint);has been removed
I tried http.exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint); as seen in some answers but it still doesnt work
I found the solution. Apparently spring has removed http.exceptionHandling() in spring 6.1 so to solve the problem I did
http.exceptionHandling((exception)-> exception.authenticationEntryPoint(jwtAuthenticationEntryPoint).accessDeniedPage("/error/accedd-denied"));
If in Kotlin
.exceptionHandling {
it.authenticationEntryPoint(jwtAuthenticationEntryPoint)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With