remove unnecessary class
This commit is contained in:
parent
f0175dd4f5
commit
2b78cdbafa
@ -1,20 +0,0 @@
|
|||||||
package com.baeldung.securityextrafields;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.springframework.security.core.AuthenticationException;
|
|
||||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
|
||||||
|
|
||||||
public class CustomAuthFailureHandler extends SimpleUrlAuthenticationFailureHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception)
|
|
||||||
throws IOException, ServletException {
|
|
||||||
getRedirectStrategy().sendRedirect(request, response, "/login?error=true");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -10,6 +10,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
|||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
||||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||||
|
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@ -51,10 +52,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
provider.setPasswordEncoder(passwordEncoder());
|
provider.setPasswordEncoder(passwordEncoder());
|
||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CustomAuthFailureHandler failureHandler() {
|
public SimpleUrlAuthenticationFailureHandler failureHandler() {
|
||||||
return new CustomAuthFailureHandler();
|
return new SimpleUrlAuthenticationFailureHandler("/login?error=true");
|
||||||
}
|
}
|
||||||
|
|
||||||
public PasswordEncoder passwordEncoder() {
|
public PasswordEncoder passwordEncoder() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user