config: config set

dev
minuk926 2 years ago
parent faa273f382
commit 1aab5db212

@ -0,0 +1,37 @@
package com.xit.core.oauth2.oauth.service;
import com.xit.biz.ctgy.auth.UserMinPrincipal;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.v2.repository.UserDao;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class CustomUserDetailsService implements UserDetailsService {
private final UserDao userDao;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
MinUserinfoDto user = userDao.findByUserid(username).orElseThrow(() -> new CustomBaseException(ErrorCode.USER_NOT_FOUND));
return UserMinPrincipal.create(MinUserinfo.builder()
.userid(user.getUserid())
.passwd(user.getPasswd())
.name(user.getName())
.regnum(user.getRegnum())
.mphone(user.getMphone())
.email(user.getEmail())
.accesstype(user.getAccesstype())
.regdate(user.getRegdate())
.isenable(user.getIsenable())
.gu(user.getGu())
.build());
}
}
Loading…
Cancel
Save