API key security not imported from Swagger (OAS3) yaml
I've imported an open API specifications version 3.0 yaml file at creating a new project. This Swagger OAS definition contains security:
security: - apiKeyBAG: []
and in the #/components/securitySchemes:
securitySchemes: apiKeyBAG: type: apiKey name: X-Api-Key in: header
In ReadyApi SoapUI I don't find this header anywhere and haven't found a way to add this in the Auth Manager. This means I have to manually add this header to every operation in the API.
Is there something wrong with the way this was defined in the Swagger file? (I wouldn't think so, SwaggerHub does recognize the security)
Or is there another way to get and use the defined security (api key)?
Thank you for the advice nmrao!
Hi fsamwel , I see that you did go to the Support Team with this issue.
Let me copy their reply here:
>>
Currently, the "API Key" authentication type is not available in ReadyAPI, and the "apikey" security scheme specified in a Swagger/OpenAPI definition is ignored on import.
We already have an enhancement request for supporting the "API Key" type in Auth Manager - its internal ID is RIA-12389. I've increased its rating based on your inquiry.
In the meantime, we can suggest the following options:
1. Add the header parameter to each resource (example: https://s3.eu-west-1.amazonaws.com/ccfileshare/natalie/2020/2020-03-04_13-57-18.png) - it's quicker than adding the header to each request.
2. Use an event handler that adds the needed header to outgoing requests (example: https://s3.eu-west-1.amazonaws.com/ccfileshare/natalie/2020/2020-03-04_14-02-07.png). Note: you can filter requests which the handler should be applied to - you can find an example here: https://smartbear-cc.force.com/portal/KbArticleViewer?name=How-to-make-event-RequestFilter-filterRequests-run-for-certain-test-cases&sp=all<<