feat: init commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package xin.merlin.myblog_server.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xin.merlin.myblog_server.entity.Account;
|
||||
import xin.merlin.myblog_server.service.impl.AccountServiceImpl;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Service
|
||||
public class LoginDetails implements UserDetailsService {
|
||||
|
||||
@Autowired
|
||||
private AccountServiceImpl accountServiceImpl;
|
||||
|
||||
@Override
|
||||
public CustomUserDetails loadUserByUsername(String u_account) throws UsernameNotFoundException {
|
||||
Account account = accountServiceImpl.getAccountInfo(u_account);
|
||||
return new CustomUserDetails(account.getU_account(), account.getU_password(),account.getU_id(), account.getRole(),new ArrayList<>());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user