Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove additional Deployment Type validation based on keytype included in JWT claims #3472

Open
wants to merge 2 commits into
base: choreo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,20 @@ public static APIKeyValidationInfoDTO validateSubscription(APIConfig apiConfig,
String apiContextTemplate = apiContext.substring(0, lastIndexOfVersion);
sub = datastore.getSubscriptionByAppIdApiContextVersionRange(app.getUUID(),
apiContextTemplate, "v" + apiSemVersion.getMajor());
if (sub == null) {
log.info(
"Valid subscription not found for oauth access token. application:" +
" {} app_UUID: {} API_Context:API_Version: {} API_UUID : {}",
app.getName(), app.getUUID(), apiContext + ":" + apiVersion, uuid);
} else {
log.debug("All information is retrieved from the in-memory data store.");
}
} catch (EnforcerException e) {
log.debug("API version: {} is not a valid semantic version", apiVersion);
}
} else {
log.debug("All information is retrieved from the in-memory data store.");
}
if (sub == null) {
log.info(
"Valid subscription not found for oauth access token. application:" +
" {} app_UUID: {} API_Context:API_Version: {} API_UUID : {}",
app.getName(), app.getUUID(), apiContext + ":" + apiVersion, uuid);
} else {
log.debug("All information is retrieved from the in-memory data store.");
}
} else {
log.info("Application not found in the data store for uuid " + key.getApplicationUUID());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,6 @@ public AuthenticationContext authenticate(RequestContext requestContext) throws
AuthenticationContext authenticationContext = FilterUtils
.generateAuthenticationContext(requestContext, jwtTokenIdentifier, validationInfo,
apiKeyValidationInfoDTO, endUserToken, jwtToken, true);
//TODO: (VirajSalaka) Place the keytype population logic properly for self contained token
if (claims.getClaim("keytype") != null) {
authenticationContext.setKeyType(claims.getClaim("keytype").toString());
}
// Check if the token has access to the gateway configured environment.
checkTokenEnvAgainstDeploymentType(requestContext.getAuthenticationContext().getKeyType(),
requestContext.getMatchedAPI());
if (!"Unlimited".equals(authenticationContext.getTier())) {
// For subscription rate limiting, it is required to populate dynamic metadata
String subscriptionId = authenticationContext.getApiUUID() + ":" +
Expand Down
Loading