补充错误处理器
This commit is contained in:
+4
@@ -134,6 +134,10 @@ public interface SecurityConstants {
|
|||||||
* 登录页面
|
* 登录页面
|
||||||
*/
|
*/
|
||||||
String LOGIN_PAGE = "/login.html";
|
String LOGIN_PAGE = "/login.html";
|
||||||
|
/**
|
||||||
|
* 登录失败页面
|
||||||
|
*/
|
||||||
|
String LOGIN_FAILURE_PAGE = LOGIN_PAGE + "?error";
|
||||||
/**
|
/**
|
||||||
* 默认的OPENID登录请求处理url
|
* 默认的OPENID登录请求处理url
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
|
|||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
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.UsernamePasswordAuthenticationFilter;
|
||||||
import org.springframework.security.web.authentication.logout.LogoutHandler;
|
import org.springframework.security.web.authentication.logout.LogoutHandler;
|
||||||
|
|
||||||
@@ -86,6 +87,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
filter.setAuthenticationManager(authenticationManager);
|
filter.setAuthenticationManager(authenticationManager);
|
||||||
filter.setFilterProcessesUrl(SecurityConstants.OAUTH_LOGIN_PRO_URL);
|
filter.setFilterProcessesUrl(SecurityConstants.OAUTH_LOGIN_PRO_URL);
|
||||||
filter.setAuthenticationSuccessHandler(authenticationSuccessHandler);
|
filter.setAuthenticationSuccessHandler(authenticationSuccessHandler);
|
||||||
|
filter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler(SecurityConstants.LOGIN_FAILURE_PAGE));
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user