feat: mpower 적용 - 게시판

dev
minuk926 2 years ago
parent a3fdb731fe
commit 6b15987f3f

@ -1,6 +1,6 @@
package com.xit.biz.ctgy.auth; package com.xit.biz.ctgy.auth;
import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; import com.xit.biz.ctgy.v2.repository.UserDao;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -17,7 +17,7 @@ public class MinPasswordEncoder implements PasswordEncoder {
@Setter @Setter
private String userid; private String userid;
private final MinUserinfoDao minUserinfoDao; private final UserDao minUserinfoDao;
/** /**
* *

@ -5,7 +5,7 @@ import com.xit.biz.ctgy.auth.service.IAuthMinService;
import com.xit.biz.ctgy.dto.LoginMinRequestDto; import com.xit.biz.ctgy.dto.LoginMinRequestDto;
import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; import com.xit.biz.ctgy.v2.repository.UserDao;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.constant.XitConstants; import com.xit.core.constant.XitConstants;
import com.xit.core.exception.TokenAuthException; import com.xit.core.exception.TokenAuthException;
@ -50,7 +50,7 @@ public class AuthMinService implements IAuthMinService {
private final AppProperties appProperties; private final AppProperties appProperties;
private final AuthenticationManager authenticationManager; private final AuthenticationManager authenticationManager;
private final MinUserinfoDao userinfoDao; private final UserDao userinfoDao;
private final JwtTokenProvider jwtTokenProvider; private final JwtTokenProvider jwtTokenProvider;
private final RefreshTokenDao refreshTokenDao; private final RefreshTokenDao refreshTokenDao;

@ -3,7 +3,7 @@ package com.xit.biz.ctgy.auth.service.impl;
import com.xit.biz.ctgy.auth.UserMinPrincipal; import com.xit.biz.ctgy.auth.UserMinPrincipal;
import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; import com.xit.biz.ctgy.v2.repository.UserDao;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException; import com.xit.core.exception.CustomBaseException;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -16,7 +16,7 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor @RequiredArgsConstructor
public class CustomMinUserDetailsService implements UserDetailsService { public class CustomMinUserDetailsService implements UserDetailsService {
private final MinUserinfoDao minUserinfoDao; private final UserDao minUserinfoDao;
@Override @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {

@ -12,7 +12,7 @@ import java.util.Optional;
@Repository @Repository
@Slf4j @Slf4j
public class MinUserinfoDao extends BaseMpowerDaoSupport { public class UserDao extends BaseMpowerDaoSupport {
public Optional<MinUserinfoDto> findByUserid(final String userid){ public Optional<MinUserinfoDto> findByUserid(final String userid){
String sql = QueryGenerator.createNamedQuery("user", "selectUserInfo") String sql = QueryGenerator.createNamedQuery("user", "selectUserInfo")
.setParameter("userid", userid) .setParameter("userid", userid)
@ -36,9 +36,9 @@ public class MinUserinfoDao extends BaseMpowerDaoSupport {
return selectOneColumn(sql); return selectOneColumn(sql);
} }
public MinUserinfo findMinUserinfoByUserid(final String userid){ // public MinUserinfo findMinUserinfoByUserid(final String userid){
return null; // return null;
} // }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// 주정차위반 심사대상 등록 - 등록 대상 심사자 조회 // 주정차위반 심사대상 등록 - 등록 대상 심사자 조회

@ -9,9 +9,9 @@ public interface IMinUserService {
Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable); Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable);
MinUserinfo findMinUser(); MinUserinfoDto findMinUser();
MinUserinfo findMinUserByUserid(final String userId); MinUserinfoDto findMinUserByUserid(final String userId);
void saveMinUser(MinUserinfoDto dto); void saveMinUser(MinUserinfoDto dto);

@ -2,18 +2,19 @@ package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; import com.xit.biz.ctgy.v2.repository.UserDao;
import com.xit.biz.ctgy.v2.service.IMinUserService; import com.xit.biz.ctgy.v2.service.IMinUserService;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException; import com.xit.core.exception.CustomBaseException;
import com.xit.core.oauth2.utils.HeaderUtil; import com.xit.core.oauth2.utils.HeaderUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.mapstruct.factory.Mappers;
import org.springframework.data.domain.*; import org.springframework.data.domain.*;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains; import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
@AllArgsConstructor @AllArgsConstructor
@ -21,7 +22,7 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc
public class MinUserService implements IMinUserService { public class MinUserService implements IMinUserService {
private final PasswordEncoder passwordEncoder; private final PasswordEncoder passwordEncoder;
private final MinUserinfoDao minUserinfoDao; private final UserDao minUserinfoDao;
@Transactional//(readOnly = true) @Transactional//(readOnly = true)
public Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable) { public Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable) {
@ -39,16 +40,16 @@ public class MinUserService implements IMinUserService {
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public MinUserinfo findMinUser() { public MinUserinfoDto findMinUser() {
//cmmUserRepos //cmmUserRepos
//return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId()); //return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId());
return minUserinfoDao.findMinUserinfoByUserid(HeaderUtil.getUserId()); return minUserinfoDao.findByUserid(HeaderUtil.getUserId()).orElse(null);
} }
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public MinUserinfo findMinUserByUserid(final String userid) { public MinUserinfoDto findMinUserByUserid(final String userid) {
return minUserinfoDao.findMinUserinfoByUserid(userid); return minUserinfoDao.findByUserid(userid).orElse(null);
} }
@Override @Override

@ -3,7 +3,7 @@ package com.xit.core.config;
import com.xit.biz.ctgy.auth.MinPasswordEncoder; import com.xit.biz.ctgy.auth.MinPasswordEncoder;
import com.xit.biz.ctgy.auth.service.impl.CustomMinOAuth2UserService; import com.xit.biz.ctgy.auth.service.impl.CustomMinOAuth2UserService;
import com.xit.biz.ctgy.auth.service.impl.CustomMinUserDetailsService; import com.xit.biz.ctgy.auth.service.impl.CustomMinUserDetailsService;
import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; import com.xit.biz.ctgy.v2.repository.UserDao;
import com.xit.core.oauth2.api.dao.RefreshTokenDao; import com.xit.core.oauth2.api.dao.RefreshTokenDao;
import com.xit.core.oauth2.config.properties.AppProperties; import com.xit.core.oauth2.config.properties.AppProperties;
import com.xit.core.oauth2.config.properties.CorsProperties; import com.xit.core.oauth2.config.properties.CorsProperties;
@ -105,7 +105,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final CustomMinOAuth2UserService customOAuth2UserService; private final CustomMinOAuth2UserService customOAuth2UserService;
private final TokenAccessDeniedHandler tokenAccessDeniedHandler; private final TokenAccessDeniedHandler tokenAccessDeniedHandler;
private final RefreshTokenDao refreshTokenDao; private final RefreshTokenDao refreshTokenDao;
private final MinUserinfoDao minUserinfoDao; private final UserDao minUserinfoDao;
/** /**
* 1. configure( WebSecurity) : * 1. configure( WebSecurity) :

Loading…
Cancel
Save