sso 테스트 코드 적용

This commit is contained in:
Rinjae
2025-11-26 21:28:10 +09:00
parent 0f760aeb42
commit 7c19f9863b
5 changed files with 484 additions and 0 deletions
@@ -0,0 +1,68 @@
package com.eactive.eai.rms.ext.kjb.sso;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService;
import com.eactive.ext.kjb.common.KjbProperty;
import com.eactive.ext.kjb.sso.ExtendedInfo;
import com.eactive.ext.kjb.sso.KjbSsoModule;
import com.eactive.ext.kjb.util.KjbPropertyInjector;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Properties;
@Slf4j
@Controller
public class SsoController {
public static final String PROP_GORUP_ID = "Monitoring";
private final KjbPropertyInjector kjbPropertyInjector;
private final KjbSsoModule ssoModule;
private final KjbProperty prop;
public SsoController(MonitoringPropertyService monitoringPropertyService) {
this.kjbPropertyInjector = new KjbPropertyInjector(monitoringPropertyService, PROP_GORUP_ID);
prop = kjbPropertyInjector.inject(new KjbProperty());
this.ssoModule = KjbSsoModule.getInstance(prop);
}
@RequestMapping(value = "/sso/login.do")
public String login(HttpServletRequest req, HttpServletResponse res,
@RequestParam("UURL") String uurl) throws Exception {
String ssoId = ssoModule.getSsoId(req);
log.debug("ssoId : {}", ssoId);
log.debug("uurl : {}", uurl);
if (StringUtils.isEmpty(uurl)) {
uurl = ssoModule.getAscpUrl();
}
if (ssoId == null) {
ssoModule.goLoginPage(res, uurl);
return null;
} else {
String retCode = ssoModule.getEamSessionCheck(req, res);
log.debug("retCode : {}", retCode);
if ("0".equalsIgnoreCase(retCode)) {
ssoModule.goErrorPage(res, Integer.parseInt(retCode));
return null;
}
Properties extendedInfo = ssoModule.getUserExFields(ssoId);
extendedInfo.keySet().forEach( k -> {
log.debug("{} : {}", k, extendedInfo.get(k));
});
return "redirect:/main.do";
}
}
}
@@ -19,6 +19,10 @@ public class KjbPropertyInjector {
this.groupId = groupId;
}
public KjbProperty inject() {
return inject(new KjbProperty());
}
public <T> T inject(T property) {
Class<?> clazz = property.getClass();