处理问题

This commit is contained in:
wanggeng 2021-08-20 16:34:56 +08:00
parent 9767f49a06
commit 3629a314bf

View File

@ -35,10 +35,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
private UserLoginService userLoginService; private UserLoginService userLoginService;
@Autowired @Autowired
private PasswordEncoder passwordEncoder; private PasswordEncoder passwordEncoder;
@Override
protected void configure(HttpSecurity http) throws Exception {
/** /**
* 默认放行配置 * 默认放行配置
*/ */
private String[] defaultAntMatchers = { String[] defaultAntMatchers = {
baseProperties.getLoginUrl(), baseProperties.getLoginUrl(),
baseProperties.getLoginProcess(), baseProperties.getLoginProcess(),
baseProperties.getLoginFailure(), baseProperties.getLoginFailure(),
@ -53,17 +56,15 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
"/api/sms/getverificationcode/*", "/api/sms/getverificationcode/*",
"/api/user/getsignintype/**" "/api/user/getsignintype/**"
}; };
@Override
protected void configure(HttpSecurity http) throws Exception {
String assetsMatchers = baseProperties.getAssetsMatchers(); String assetsMatchers = baseProperties.getAssetsMatchers();
String[] fullAntMatchers; String[] fullAntMatchers;
if (!StringUtils.isBlank(assetsMatchers)) { if (!StringUtils.isBlank(assetsMatchers)) {
String[] assetsMatchersArray = baseProperties.getAssetsMatchers().split(","); String[] assetsMatchersArray = baseProperties.getAssetsMatchers().split(",");
fullAntMatchers = ArrayUtils.addAll(defaultAntMatchers, assetsMatchers); fullAntMatchers = ArrayUtils.addAll(defaultAntMatchers, assetsMatchersArray);
} else { } else {
fullAntMatchers = defaultAntMatchers; fullAntMatchers = defaultAntMatchers;
} }
LoginFailureHandler loginFailureHandler = new LoginFailureHandler(baseProperties.getLoginFailure()); LoginFailureHandler loginFailureHandler = new LoginFailureHandler(baseProperties.getLoginFailure());
http http
.formLogin() .formLogin()