sso update
This commit is contained in:
@@ -11,8 +11,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
@@ -40,7 +43,7 @@ public class KjbSsoModule {
|
|||||||
|
|
||||||
/***[SSO ND LIST 운영]**]***********************************************************************/
|
/***[SSO ND LIST 운영]**]***********************************************************************/
|
||||||
private final String ND_URL1;
|
private final String ND_URL1;
|
||||||
private final Vector PROVIDER_LIST = new Vector();
|
private final Vector<String> PROVIDER_LIST = new Vector<String>();
|
||||||
private final int COOKIE_SESSTION_TIME_OUT = 3000000;
|
private final int COOKIE_SESSTION_TIME_OUT = 3000000;
|
||||||
|
|
||||||
// 인증 타입 (ID/PW 방식 : 1, 인증서 : 3)
|
// 인증 타입 (ID/PW 방식 : 1, 인증서 : 3)
|
||||||
@@ -86,6 +89,27 @@ public class KjbSsoModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public NXContext getContext() {
|
||||||
|
NXContext context = null;
|
||||||
|
try {
|
||||||
|
List<String> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 통합 SSO ID 조회
|
* 통합 SSO ID 조회
|
||||||
* @param request
|
* @param request
|
||||||
@@ -98,10 +122,12 @@ public class KjbSsoModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getSystemAccount(String sso_id) {
|
public String getSystemAccount(String sso_id) {
|
||||||
|
NXContext context = null;
|
||||||
NXUserAPI userAPI = null;
|
NXUserAPI userAPI = null;
|
||||||
String retValue = null;
|
String retValue = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
context = getContext();
|
||||||
userAPI = new NXUserAPI(context);
|
userAPI = new NXUserAPI(context);
|
||||||
log.info("##############################################");
|
log.info("##############################################");
|
||||||
log.info("sso_id 2: "+sso_id);
|
log.info("sso_id 2: "+sso_id);
|
||||||
@@ -193,6 +219,9 @@ public class KjbSsoModule {
|
|||||||
* @return Properties
|
* @return Properties
|
||||||
*/
|
*/
|
||||||
public Properties getUserInfos(String userid) throws Exception {
|
public Properties getUserInfos(String userid) throws Exception {
|
||||||
|
NXContext context = null;
|
||||||
|
context = getContext();
|
||||||
|
|
||||||
NXUserAPI userAPI = new NXUserAPI(context);
|
NXUserAPI userAPI = new NXUserAPI(context);
|
||||||
Properties propt = null;
|
Properties propt = null;
|
||||||
|
|
||||||
@@ -250,8 +279,8 @@ public class KjbSsoModule {
|
|||||||
* 사용자가 존재하지 않거나 확장필드가 없다면 return null
|
* 사용자가 존재하지 않거나 확장필드가 없다면 return null
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public Properties getUserExFields(String userid)
|
public Properties getUserExFields(String userid) throws Exception {
|
||||||
throws Exception {
|
NXContext context = getContext();
|
||||||
NXUserAPI userAPI = new NXUserAPI(context);
|
NXUserAPI userAPI = new NXUserAPI(context);
|
||||||
Properties prop = null;
|
Properties prop = null;
|
||||||
NXExternalFieldSet nxefs = null;
|
NXExternalFieldSet nxefs = null;
|
||||||
@@ -261,7 +290,7 @@ public class KjbSsoModule {
|
|||||||
prop = new Properties();
|
prop = new Properties();
|
||||||
|
|
||||||
if (nxefs != null) {
|
if (nxefs != null) {
|
||||||
Iterator iter = nxefs.iterator();
|
Iterator<?> iter = nxefs.iterator();
|
||||||
while(iter.hasNext()) {
|
while(iter.hasNext()) {
|
||||||
NXExternalField nxef = (NXExternalField) iter.next();
|
NXExternalField nxef = (NXExternalField) iter.next();
|
||||||
if(nxef.getName().equals("PASSINIT")){
|
if(nxef.getName().equals("PASSINIT")){
|
||||||
@@ -278,7 +307,9 @@ public class KjbSsoModule {
|
|||||||
}
|
}
|
||||||
} catch (EmptyResultException e) {
|
} catch (EmptyResultException e) {
|
||||||
// 사용자가 존재하지 않거나 확장필드가 없음
|
// 사용자가 존재하지 않거나 확장필드가 없음
|
||||||
|
log.warn("사용자가 존재하지 않거나 확장필드가 없음", e);
|
||||||
} catch (APIException e) {
|
} catch (APIException e) {
|
||||||
|
log.warn("SSO-APIException", e);
|
||||||
throw e;
|
throw e;
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -293,6 +324,7 @@ public class KjbSsoModule {
|
|||||||
*/
|
*/
|
||||||
public String getUserExField(String userid, String exName)
|
public String getUserExField(String userid, String exName)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
NXContext context = getContext();
|
||||||
NXUserAPI userAPI = new NXUserAPI(context);
|
NXUserAPI userAPI = new NXUserAPI(context);
|
||||||
NXExternalField nxef = null;
|
NXExternalField nxef = null;
|
||||||
String returnValue = null;
|
String returnValue = null;
|
||||||
@@ -304,6 +336,7 @@ public class KjbSsoModule {
|
|||||||
returnValue = (String) nxef.getValue();
|
returnValue = (String) nxef.getValue();
|
||||||
} catch (EmptyResultException e) {
|
} catch (EmptyResultException e) {
|
||||||
// 사용자가 존재하지 않거나 확장필드가 없음
|
// 사용자가 존재하지 않거나 확장필드가 없음
|
||||||
|
log.warn("사용자가 존재하지 않거나 확장필드가 없음", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("KjbSsoModule-getUserExField Exception", e);
|
log.error("KjbSsoModule-getUserExField Exception", e);
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
Reference in New Issue
Block a user