-
Notifications
You must be signed in to change notification settings - Fork 280
oauth2 authorization option #454
Comments
@timgent Thank you, this is generally a feature request for Dredd to handle auth, in this particular case OAuth2. Before we start to add support for auth to Dredd we would like to first bake in the support to the underlying API description language. Swagger (see plans in #389) already supports describing auth. There are proposals on how to bring description of auth to API Blueprint: https://github.com/apiaryio/api-blueprint-rfcs/tree/master/rfcs But it's not implemented yet in the parser. If that gets implemented, we could teach Dredd how to respect it. Would that be a solution for you? What is your use case? Do you test your production API or it's about CI, development, etc.? In development, you could work around auth headers by hooks. |
Thanks for the quick reply @honzajavorek , some more details below Your Proposed Solution When testing locally or in CI before any deployments only the API is being tested, so no auth component is required. Once deployed (to dev, preprod, etc) the tests will be run against the deployed version of the server which will include a proxy in front of it. The solution as proposed would work for us, though it would be extra nice to be able to provide a flag to disable having to test the auth too (for example when testing locally without our auth infrastructure). Only thing I wasn't clear about with the proposal was how to mark other endpoints in the specification as requiring authorization. Workarounds for the time being |
@timgent Yes you can use hooks as a workaround, see Dredd docs on hooks for some examples. You can utilize |
@w-vi Thanks that helps a lot, looks pretty straightforward |
I'd leave it on hooks. Supporting oauth2 out of the box feels out of scope for Dredd now. There are bigger challenges we're facing. |
I have an API secured with the oauth2 specification. To connect to it a consumer needs to:
I would propose usage along the lines of:
dredd --authtype oauth2 --user tim:password --oauthroute /oauth/login
With authtype defaulting to basic otherwise
Thoughts appreciated
The text was updated successfully, but these errors were encountered: