Skip to content

Commit

Permalink
Fix for userId validation
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento committed Feb 13, 2023
1 parent 70a4e32 commit 2c10188
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 7 additions & 5 deletions src/main/java/org/sunbird/common/util/AccessTokenValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> validateToken(String token) throws Exception {
try {
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/org/sunbird/common/util/RequestInterceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Short> apiHeaderIgnoreMap = new ConcurrentHashMap<>();

private RequestInterceptor() {
}
Expand Down

0 comments on commit 2c10188

Please sign in to comment.