CA Gateway 토큰 처리
1. 기존메모리에서 따로 관리하던것을 인터스끼리 공유 할수있도록 sessionManager에서 토큰을 관리.(CAToken 관리용 cache 추가 작업) 2. ApiAuthFilter.java 에 ca 방식 토큰 인증 로직 추가. 나머지는 CA토큰 발급(BearerTokenController)처리 및 BeareTokenInfo 는 어윤삼 부장 작업본 그대로 사용.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.eactive.eai.common.session;
|
||||
|
||||
import com.eactive.eai.authserver.service.BearerTokenInfo;
|
||||
import com.eactive.eai.common.lifecycle.Lifecycle;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleException;
|
||||
import com.eactive.eai.common.lifecycle.LifecycleListener;
|
||||
@@ -58,6 +59,7 @@ public abstract class SessionManager implements Lifecycle {
|
||||
public static final String USERID_CAHCE_NAME = "convertUserIdSession";
|
||||
public static final String WEBSOCKER_CAHCE_NAME = "webSocketTimeout";
|
||||
public static final String TERMINAL_CAHCE_NAME = "terminalSession";
|
||||
public static final String CAGATEWAY_TOKEN_CACHE_NAME = "CAGatewayToken";
|
||||
|
||||
public static final String SESSION_MANAGER_GROUPNAME = "RMIInfo";
|
||||
public static final String SESSION_MANAGER_CACHETYPE = "cacheType";
|
||||
@@ -193,6 +195,14 @@ public abstract class SessionManager implements Lifecycle {
|
||||
public abstract void putLogin(String key, SessionVO value);
|
||||
|
||||
public abstract void removeLogin(String key);
|
||||
|
||||
//CA Token Cache
|
||||
public abstract BearerTokenInfo getCAToken(String key);
|
||||
|
||||
public abstract void putCAToken(String key, BearerTokenInfo value);
|
||||
|
||||
public abstract void removeCAToken(String key);
|
||||
|
||||
|
||||
// HTTP Cache
|
||||
public abstract SessionVO getHttpLogin(String key);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.eactive.eai.common.session;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.eactive.eai.authserver.service.BearerTokenInfo;
|
||||
import com.eactive.eai.common.ehcache.CustomRMICacheReplicatorFactory;
|
||||
import com.eactive.eai.common.logger.EAIDBLogControl;
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
@@ -921,4 +922,19 @@ public class SessionManagerForEhcache extends SessionManager {
|
||||
sb.append("</Caches>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BearerTokenInfo getCAToken(String key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putCAToken(String key, BearerTokenInfo value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCAToken(String key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMultic
|
||||
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
|
||||
|
||||
import com.eactive.eai.adapter.socket2.common.Env;
|
||||
import com.eactive.eai.authserver.service.BearerTokenInfo;
|
||||
import com.eactive.eai.common.logger.EAIDBLogControl;
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
@@ -63,6 +64,7 @@ import ch.qos.logback.classic.Level;
|
||||
// 에러내용 : Failed to execute the cache operation
|
||||
// (all partition owners have left the grid, partition data has been lost)
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
public class SessionManagerForIgnite extends SessionManager {
|
||||
// evictMaster Instance - single socket 관련
|
||||
private static IgniteCache<String, String> evictMasterCache = null;
|
||||
@@ -72,7 +74,8 @@ public class SessionManagerForIgnite extends SessionManager {
|
||||
private static IgniteCache<String, EAIMessage> cacheTopic = null;
|
||||
// 비동기 거래 복원용
|
||||
private static IgniteCache<String, CacheStoreObject> cacheStore = null;
|
||||
|
||||
// CA Gateway Token 관리용
|
||||
private static IgniteCache<String, BearerTokenInfo> cacheCAToken = null;
|
||||
// webSocket Login cache 정보
|
||||
private static IgniteCache<String, SessionVO> cacheLogin = null; // key = loginId
|
||||
private static IgniteCache<String, String> cacheConvertUserId = null; // 단말ID 를 userID로 변경
|
||||
@@ -364,6 +367,7 @@ public class SessionManagerForIgnite extends SessionManager {
|
||||
caches.add(initCache(config, sessionTimeout, bootstrapAsynchronously, USERID_CAHCE_NAME, 20000, false));
|
||||
caches.add(initCache(config, webSocketTimeout, bootstrapAsynchronously, WEBSOCKER_CAHCE_NAME, 20000, false));
|
||||
caches.add(initCache(config, sessionTimeout, bootstrapAsynchronously, TERMINAL_CAHCE_NAME, 20000, false));
|
||||
caches.add(initCache(config, 0, bootstrapAsynchronously, CAGATEWAY_TOKEN_CACHE_NAME, 1000, false));
|
||||
|
||||
config.setCacheConfiguration(caches.stream().toArray(CacheConfiguration[]::new));
|
||||
|
||||
@@ -391,6 +395,7 @@ public class SessionManagerForIgnite extends SessionManager {
|
||||
cacheSocket = manager.cache(ADAPTER_CAHCE_NAME);
|
||||
cacheTopic = manager.cache(TOPIC_CAHCE_NAME);
|
||||
cacheStore = manager.cache(STORE_CAHCE_NAME);
|
||||
cacheCAToken = manager.cache(CAGATEWAY_TOKEN_CACHE_NAME);
|
||||
|
||||
cacheLogin = manager.cache(LOGIN_CAHCE_NAME);
|
||||
httpLogin = manager.cache(HTTP_CAHCE_NAME);
|
||||
@@ -810,4 +815,33 @@ public class SessionManagerForIgnite extends SessionManager {
|
||||
sb.append("</Caches>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BearerTokenInfo getCAToken(String key) {
|
||||
try {
|
||||
return cacheCAToken.get(key);
|
||||
} catch (Exception e) {
|
||||
logger.error("getCAToken null key=" + key, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putCAToken(String key, BearerTokenInfo value) {
|
||||
if (logger.isWarn()) {
|
||||
logger.warn("Put CAToken key - " + key + ", CAToken - " + value.toString());
|
||||
}
|
||||
cacheCAToken.put(key, value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCAToken(String key) {
|
||||
if (logger.isWarn()) {
|
||||
logger.warn("Remove CAToken key - " + key);
|
||||
}
|
||||
cacheCAToken.remove(key);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user