@Bean
UserDetailsService userDetailsService() {
return username -> {
LOGGER.debug(String.format("Looking for user [%s]", username));
Account account = accountRepository.findByUsername(username);
if (account != null) {
LOGGER.info(String.format("Found user [%s]", username));
return new User(account.getUsername(), account.getPassword(),
true, true, true, true,
AuthorityUtils.createAuthorityList("USER"));
} else {
LOGGER.info(String.format("Couldn't find user [%s]", username));
throw new UsernameNotFoundException(String.format("couldn't find the user '%s'", username));
}
};
}
WebSecurityAuthenticationConfigurer.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:chvote-protocol-poc
作者:
评论列表
文章目录