mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-31 08:14:18 +08:00
✨ Introducing new features. 手机号登录
This commit is contained in:
parent
89ef0003fc
commit
3bc9d64a05
@ -62,7 +62,6 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
|||||||
*/
|
*/
|
||||||
private PhoneAuthenticationProvider phoneAuthenticationProvider() {
|
private PhoneAuthenticationProvider phoneAuthenticationProvider() {
|
||||||
PhoneAuthenticationProvider phoneAuthenticationProvider = new PhoneAuthenticationProvider();
|
PhoneAuthenticationProvider phoneAuthenticationProvider = new PhoneAuthenticationProvider();
|
||||||
phoneAuthenticationProvider.setPasswordEncoder(passwordEncoder());
|
|
||||||
phoneAuthenticationProvider.setUserDetailsService(userDetailsService);
|
phoneAuthenticationProvider.setUserDetailsService(userDetailsService);
|
||||||
return phoneAuthenticationProvider;
|
return phoneAuthenticationProvider;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.pig4cloud.pig.common.security.service.PigUserDetailsServiceImpl;
|
import com.pig4cloud.pig.common.security.service.PigUserDetailsServiceImpl;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.BeanCreationException;
|
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
|
import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
|
||||||
@ -13,7 +12,6 @@ import org.springframework.security.core.AuthenticationException;
|
|||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hzq
|
* @author hzq
|
||||||
@ -25,9 +23,6 @@ public class PhoneAuthenticationProvider extends AbstractUserDetailsAuthenticati
|
|||||||
@Setter
|
@Setter
|
||||||
private UserDetailsService userDetailsService;
|
private UserDetailsService userDetailsService;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private PasswordEncoder passwordEncoder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验 请求信息userDetails
|
* 校验 请求信息userDetails
|
||||||
* @param userDetails 用户信息
|
* @param userDetails 用户信息
|
||||||
@ -51,7 +46,7 @@ public class PhoneAuthenticationProvider extends AbstractUserDetailsAuthenticati
|
|||||||
|
|
||||||
if (authentication.getCredentials() == null) {
|
if (authentication.getCredentials() == null) {
|
||||||
log.debug("Failed to authenticate since no credentials provided");
|
log.debug("Failed to authenticate since no credentials provided");
|
||||||
throw new BeanCreationException("Bad credentials");
|
throw new BadCredentialsException("Bad credentials");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手机号
|
// 手机号
|
||||||
|
Loading…
Reference in New Issue
Block a user