Fix for https://github.com/wso2/api-manager/issues/2226 #2114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
When an OPTIONS resource is invoked when there is another HTTP_METHOD with the same path as the OPTIONS resource, the OPTIONS call does not hit the backend and a X-JWT-ASSERTION header is added to the response of the OPTIONS call. This is happening due to improper resource filtering by HTTP_METHOD for OPTIONs call.
When a resource is invoked, synapse gets all the resources for that api and first filters by HTTP_METHOD and then filters by the path of the resource. When an options call is sent the first filter does not work as expected and it returns all the resources. Therefore in the next filter if there is another resource with the same path as the OPTIONS call, it may get selected according to the order of the LinkedHashSet.
In the micro-integrator, when an OPTIONS call is sent when there is no OPTIONS call defined, it returns all the allowed resources. This flow is reintroduced in this fix.
Resolves
wso2/api-manager#2226