Skip to content

Commit

Permalink
fix: handle multiple plans of the same type with validateSubscription…
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiiiel committed Oct 29, 2024
1 parent 3a93285 commit 8650b1e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package io.gravitee.gateway.handlers.api.security;

import static io.gravitee.gateway.security.core.AuthenticationContext.ATTR_INTERNAL_LAST_SECURITY_HANDLER_SUPPORTING_SAME_TOKEN_TYPE;
import static io.gravitee.gateway.security.core.AuthenticationContext.ATTR_INTERNAL_TOKEN_IDENTIFIED;

import io.gravitee.definition.model.Plan;
Expand Down Expand Up @@ -94,6 +95,10 @@ protected boolean canHandleSelectionRule(AuthenticationContext authenticationCon
if (Boolean.FALSE.equals(value)) {
authenticationContext.setInternalAttribute(ATTR_INTERNAL_TOKEN_IDENTIFIED, false);
}

// Set as Last handler (jwt or oauth), no need to check the subscription,
// let the CheckSubscriptionPolicy do the job and return an appropriate error.
authenticationContext.setInternalAttribute(ATTR_INTERNAL_LAST_SECURITY_HANDLER_SUPPORTING_SAME_TOKEN_TYPE, true);
return Boolean.TRUE.equals(value);
} catch (ParseException | EvaluationException e) {
LOGGER.error("Plan selection rule execution failed", e);
Expand Down

0 comments on commit 8650b1e

Please sign in to comment.