feat: init commit

This commit is contained in:
merlin
2025-10-16 16:57:27 +08:00
commit 4f84603d82
57 changed files with 2243 additions and 0 deletions

View File

@@ -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<>());
}
}