SSO 인증처리 부분 추가

This commit is contained in:
urp 2026-04-06 13:40:20 +09:00
parent 506e52807f
commit 6d941f5436
2 changed files with 28 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package com.urpsys.baseauth.inner.provider;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import org.codehaus.jettison.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -13,6 +14,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import com.urpsys.baseauth.domain.MemberVO;
import com.urpsys.baseauth.service.UserDetailService; import com.urpsys.baseauth.service.UserDetailService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -59,6 +61,9 @@ public class CustomAuthenticationProvider implements AuthenticationProvider
String username = (String) authentication.getPrincipal(); String username = (String) authentication.getPrincipal();
String password = (String) authentication.getCredentials(); String password = (String) authentication.getCredentials();
// String strDetails = (String) authentication.getDetails();
log.info(" 어떤 정보 strDetails => [{}]", authentication.getDetails());
// 사용자 Lock 체크 // 사용자 Lock 체크
LinkedHashMap<String, Object> returnMap = userDetailService.selectLoginIncorrect(username); LinkedHashMap<String, Object> returnMap = userDetailService.selectLoginIncorrect(username);
@ -75,11 +80,30 @@ public class CustomAuthenticationProvider implements AuthenticationProvider
} }
log.info("## => username:{} | password:{} ", username, password); log.info("## => username:{} | password:{} ", username, password);
log.info("## => 또다른 정보1 : [{}] ", authentication.getDetails()); log.info("## => 또다른 정보1 : [{}] ", authentication.getDetails());
log.info("## => 또다른 정보2 : [{}] ", authentication.toString()); log.info("## => 또다른 정보2 : [{}] ", authentication.toString());
// 2026.04.02 나혁제 SSO 처리여부 추출
LinkedHashMap<String, Object> reqDetails = (LinkedHashMap)authentication.getDetails();
String strSsoYn = (String)reqDetails.get("ssoYn");
log.info("## => strSsoYn : [{}] ", strSsoYn);
UserDetails info = userDetailService.loadUserByUsername(username); // 사용자 정보 추출 UserDetails info = userDetailService.loadUserByUsername(username); // 사용자 정보 추출
// sso 들어오는 경우 페스워드 처리
if(strSsoYn.equals("Y"))
{
MemberVO memberVo = (MemberVO)info;
memberVo.setPasswordHash (passwordEncoder.encode(password) );
memberVo.setStrPWD (passwordEncoder.encode(password) );
info = memberVo;
}
if(ObjectUtils.isEmpty(info)) if(ObjectUtils.isEmpty(info))
{ {
String strExist = userDetailService.userExistYn(username); String strExist = userDetailService.userExistYn(username);

View File

@ -56,7 +56,6 @@ public class UserDetailService implements UserDetailsService
MemberVO memberVo = memberDao.actionLogin(strUserId); MemberVO memberVo = memberDao.actionLogin(strUserId);
if(memberVo == null) if(memberVo == null)
{ {
log.info("사용자가 존재하지 않음"); log.info("사용자가 존재하지 않음");