提交 c250fb58 编写于 作者: zlt2000's avatar zlt2000

补充错误处理器

上级 e9f4832c
......@@ -134,6 +134,10 @@ public interface SecurityConstants {
* 登录页面
*/
String LOGIN_PAGE = "/login.html";
/**
* 登录失败页面
*/
String LOGIN_FAILURE_PAGE = LOGIN_PAGE + "?error";
/**
* 默认的OPENID登录请求处理url
*/
......
......@@ -22,6 +22,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.logout.LogoutHandler;
......@@ -86,6 +87,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
filter.setAuthenticationManager(authenticationManager);
filter.setFilterProcessesUrl(SecurityConstants.OAUTH_LOGIN_PRO_URL);
filter.setAuthenticationSuccessHandler(authenticationSuccessHandler);
filter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler(SecurityConstants.LOGIN_FAILURE_PAGE));
return filter;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册