mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-14 22:29:00 +08:00
✨ Introducing new features. #4361 如何将用户名或密码不正确的中文提示改为英文提示
This commit is contained in:
1 parent
1c7d92a4ce
commit
85c19f664d
4 files changed
+10
-3
No files matched your search
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.auth.config;
|
||||
|
||||
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
|
||||
import com.pig4cloud.pigx.common.security.component.PigxDaoAuthenticationProvider;
|
||||
import com.pig4cloud.pigx.common.security.grant.CustomAppAuthenticationProvider;
|
||||
import com.pig4cloud.pigx.common.security.handler.FormAuthenticationFailureHandler;
|
||||
@@ -27,6 +28,7 @@ import com.pig4cloud.pigx.common.security.handler.SsoLogoutSuccessHandler;
|
||||
import com.pig4cloud.pigx.common.security.handler.TenantSavedRequestAwareAuthenticationSuccessHandler;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
@@ -71,11 +73,16 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(AuthenticationManagerBuilder auth) {
|
||||
PigxDaoAuthenticationProvider daoAuthenticationProvider = new PigxDaoAuthenticationProvider();
|
||||
daoAuthenticationProvider.setPasswordEncoder(passwordEncoder());
|
||||
// 注入自定义异常国际化文件处理器
|
||||
MessageSource messageSource = SpringContextHolder.getBean("securityMessageSource");
|
||||
daoAuthenticationProvider.setMessageSource(messageSource);
|
||||
|
||||
// 处理默认的密码模式认证
|
||||
auth.authenticationProvider(daoAuthenticationProvider);
|
||||
// 自定义的认证模式
|
||||
auth.authenticationProvider(new CustomAppAuthenticationProvider());
|
||||
CustomAppAuthenticationProvider customAppAuthenticationProvider = new CustomAppAuthenticationProvider();
|
||||
customAppAuthenticationProvider.setMessageSource(messageSource);
|
||||
auth.authenticationProvider(customAppAuthenticationProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user