diff --git a/src/main/java/org/sunbird/common/util/AccessTokenValidator.java b/src/main/java/org/sunbird/common/util/AccessTokenValidator.java index 9fd676960..12c64ea59 100644 --- a/src/main/java/org/sunbird/common/util/AccessTokenValidator.java +++ b/src/main/java/org/sunbird/common/util/AccessTokenValidator.java @@ -14,6 +14,7 @@ public class AccessTokenValidator { private static Logger logger = LoggerFactory.getLogger(AccessTokenValidator.class.getName()); private static ObjectMapper mapper = new ObjectMapper(); + private static PropertiesCache cache = PropertiesCache.getInstance(); private static Map validateToken(String token) throws Exception { try { @@ -64,11 +65,12 @@ public static String verifyUserToken(String token) { return userId; } - private static boolean checkIss(String iss) { - String realmUrl = - KeyCloakConnectionProvider.SSO_URL + "realms/" + KeyCloakConnectionProvider.SSO_REALM; - return (realmUrl.equalsIgnoreCase(iss)); - } + private static boolean checkIss(String iss) { + String realmUrl = cache.getProperty(Constants.SSO_URL) + "realms/" + cache.getProperty(Constants.SSO_REALM); + if (StringUtils.isBlank(realmUrl)) + return false; + return (realmUrl.equalsIgnoreCase(iss)); + } private static boolean isExpired(Integer expiration) { return (Time.currentTime() > expiration); diff --git a/src/main/java/org/sunbird/common/util/RequestInterceptor.java b/src/main/java/org/sunbird/common/util/RequestInterceptor.java index 9445a4176..c098fee6c 100644 --- a/src/main/java/org/sunbird/common/util/RequestInterceptor.java +++ b/src/main/java/org/sunbird/common/util/RequestInterceptor.java @@ -3,12 +3,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.ConcurrentHashMap; - public class RequestInterceptor { private static Logger logger = LoggerFactory.getLogger(RequestInterceptor.class.getName()); - private static ConcurrentHashMap apiHeaderIgnoreMap = new ConcurrentHashMap<>(); private RequestInterceptor() { }