-
Notifications
You must be signed in to change notification settings - Fork 644
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
Introduce a config to continue backend JWT generation on user claim retrieval failure #13051
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes update the JWT handling logic by modifying method signatures and error handling in the JWT validator and token generation components. New exceptions may now be thrown if user claim retrieval fails, depending on a configuration flag. Additionally, a new constant and configuration option are introduced, supported by updates in the configuration DTO and external configuration files, to control behavior when retrieving custom claims fails. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant H as AbstractKeyValidationHandler
participant V as JWTValidator
participant CFG as JWTConfiguration
C->>H: generateConsumerToken()
H->>V: getUserClaimsFromKeyManager(jwtInfoDto)
alt Claim retrieval succeeds
V-->>H: Return user claims
H->>H: Set endUserToken
H-->>C: Return true (token generated)
else Claim retrieval fails
V-->>H: Throws JWTGeneratorException
H->>CFG: Check continueOnClaimRetrievalFailure
alt Not allowed to continue
H-->>C: Throw APIKeyMgtException
else Allowed to continue
H->>H: Log error and return false
H-->>C: Return false (failure handled)
end
end
sequenceDiagram
participant XML as Config XML (api-manager.xml.j2)
participant AC as APIManagerConfiguration
participant DTO as ExtendedJWTConfigurationDto
XML->>AC: Provide <ContinueOnClaimRetrievalFailure> element
AC->>DTO: Set continueOnClaimRetrievalFailure flag
Assessment against linked issues
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (8)
🧰 Additional context used🧬 Code Definitions (1)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIManagerConfiguration.java (1)
⏰ Context from checks skipped due to timeout of 90000ms (6)
🔇 Additional comments (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Fixes wso2/api-manager#3816
Config
apim.jwt.continue_on_claim_retrieval_failure
was newly introduced. This is true by default.Following is a sample usage :
Response Codes
When the config enabled,
invocations providing JWT token when exception is thrown during user claim retrieval. (HTTP status code - 401):
Invocations providing Opaque token :