diff --git a/src/main/java/com/eactive/ext/kjb/sso/KjbSsoModule.java b/src/main/java/com/eactive/ext/kjb/sso/KjbSsoModule.java index 8bf6e46..8b47976 100644 --- a/src/main/java/com/eactive/ext/kjb/sso/KjbSsoModule.java +++ b/src/main/java/com/eactive/ext/kjb/sso/KjbSsoModule.java @@ -11,8 +11,11 @@ import lombok.extern.slf4j.Slf4j; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; +import java.util.List; import java.util.Properties; import java.util.Vector; @@ -40,7 +43,7 @@ public class KjbSsoModule { /***[SSO ND LIST 운영]**]***********************************************************************/ private final String ND_URL1; - private final Vector PROVIDER_LIST = new Vector(); + private final Vector PROVIDER_LIST = new Vector(); private final int COOKIE_SESSTION_TIME_OUT = 3000000; // 인증 타입 (ID/PW 방식 : 1, 인증서 : 3) @@ -84,6 +87,27 @@ public class KjbSsoModule { log.debug("KjbProperty : {}", prop.toString()); } + + + @SuppressWarnings("unchecked") + public NXContext getContext() { + NXContext context = null; + try { + List serverurlList = new ArrayList<>(); + serverurlList.add(ND_URL1); + context = new NXContext(serverurlList); + CookieManager.setEncStatus(true); + + PROVIDER_LIST.add(prop.getSsoDomain()); + //NLS3 web.xml의 CookiePadding 값과 같아야 한다. 안그럼 검증 페일남 + SECode.setCookiePadding("_V42"); + } + catch (Exception e) + { + e.printStackTrace(); + } + return context; + } /** @@ -98,10 +122,12 @@ public class KjbSsoModule { } public String getSystemAccount(String sso_id) { + NXContext context = null; NXUserAPI userAPI = null; String retValue = null; try { + context = getContext(); userAPI = new NXUserAPI(context); log.info("##############################################"); log.info("sso_id 2: "+sso_id); @@ -193,6 +219,9 @@ public class KjbSsoModule { * @return Properties */ public Properties getUserInfos(String userid) throws Exception { + NXContext context = null; + context = getContext(); + NXUserAPI userAPI = new NXUserAPI(context); Properties propt = null; @@ -250,8 +279,8 @@ public class KjbSsoModule { * 사용자가 존재하지 않거나 확장필드가 없다면 return null */ @SuppressWarnings("rawtypes") - public Properties getUserExFields(String userid) - throws Exception { + public Properties getUserExFields(String userid) throws Exception { + NXContext context = getContext(); NXUserAPI userAPI = new NXUserAPI(context); Properties prop = null; NXExternalFieldSet nxefs = null; @@ -261,7 +290,7 @@ public class KjbSsoModule { prop = new Properties(); if (nxefs != null) { - Iterator iter = nxefs.iterator(); + Iterator iter = nxefs.iterator(); while(iter.hasNext()) { NXExternalField nxef = (NXExternalField) iter.next(); if(nxef.getName().equals("PASSINIT")){ @@ -278,7 +307,9 @@ public class KjbSsoModule { } } catch (EmptyResultException e) { // 사용자가 존재하지 않거나 확장필드가 없음 + log.warn("사용자가 존재하지 않거나 확장필드가 없음", e); } catch (APIException e) { + log.warn("SSO-APIException", e); throw e; //e.printStackTrace(); } @@ -293,6 +324,7 @@ public class KjbSsoModule { */ public String getUserExField(String userid, String exName) throws Exception { + NXContext context = getContext(); NXUserAPI userAPI = new NXUserAPI(context); NXExternalField nxef = null; String returnValue = null; @@ -304,6 +336,7 @@ public class KjbSsoModule { returnValue = (String) nxef.getValue(); } catch (EmptyResultException e) { // 사용자가 존재하지 않거나 확장필드가 없음 + log.warn("사용자가 존재하지 않거나 확장필드가 없음", e); } catch (Exception e) { log.error("KjbSsoModule-getUserExField Exception", e); throw e;