Skip to content

Commit

Permalink
Only send descriptor values if ratelimit tier specified in subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Tharsanan1 committed Oct 15, 2024
1 parent 60372dd commit 2599de5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private AuthenticationContext processAPIKey(RequestContext requestContext, Strin
String versionToMatch = requestContext.getMatchedAPI().getVersion();
Matcher matcher = pattern.matcher(versionToMatch);
if (matcher.matches()) {
if (!"Unlimited".equals(subscription.getRatelimitTier())) {
if (!"Unlimited".equals(subscription.getRatelimitTier()) && subscription.getRatelimitTier() != null && !subscription.getRatelimitTier().isEmpty()) {
String subscriptionId = subscription.getSubscribedApi().getName() + ":" +
app.getUUID() + subscription.getSubscriptionId();
requestContext.addMetadataToMap("ratelimit:subscription", subscriptionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public AuthenticationContext authenticate(RequestContext requestContext) throws
String versionToMatch = requestContext.getMatchedAPI().getVersion();
Matcher matcher = pattern.matcher(versionToMatch);
if (matcher.matches()) {
if (!"Unlimited".equals(subscription.getRatelimitTier())) {
if (!"Unlimited".equals(subscription.getRatelimitTier()) && subscription.getRatelimitTier() != null && !subscription.getRatelimitTier().isEmpty()) {
String subscriptionId = subscription.getSubscribedApi().getName() + ":" +
applicationId + subscription.getSubscriptionId();
requestContext.addMetadataToMap("ratelimit:subscription", subscriptionId);
Expand Down

0 comments on commit 2599de5

Please sign in to comment.