org.springframework.security.authentication.AccountStatusUserDetailsChecker Java Examples

The following examples show how to use org.springframework.security.authentication.AccountStatusUserDetailsChecker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomUserDetailsService.java    From spring-boot-2-oauth2-authorization-jwt with MIT License 6 votes vote down vote up
@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;
}
 
Example #2
Source File: CustomUserDetailsService.java    From microservices-oauth with Apache License 2.0 6 votes vote down vote up
@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();
}