org.springframework.security.authentication.AccountStatusUserDetailsChecker源码实例Demo

类org.springframework.security.authentication.AccountStatusUserDetailsChecker源码实例Demo

下面列出了org.springframework.security.authentication.AccountStatusUserDetailsChecker 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public UserDetails loadUserByUsername(String input) {
	User user = null;

	if (input.contains("@"))
		user = userRepository.findByEmail(input);
	else
		user = userRepository.findByUsername(input);

	if (user == null)
		throw new BadCredentialsException("Bad credentials");

	new AccountStatusUserDetailsChecker().check(user);

	return user;
}
 
@Override
public UserDetails loadUserByUsername(String input) {
	Optional<User> user = null;

	if (input.contains("@"))
		user = userRepository.findByEmail(input);
	else
		user = userRepository.findByUsername(input);

	if (!user.isPresent())
		throw new BadCredentialsException("Bad credentials");

	new AccountStatusUserDetailsChecker().check(user.get());

	return user.get();
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。
 类方法
 同包方法