-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Specifying HMAC-based authentication in the spec #344
Comments
👍 Would be really nice to have better support for HMAC. |
@bow - it would help to know what would be required to support HMAC. Don't really know the specifics of it. |
Ah indeed, HMAC is too broad of a term. I'll try to elaborate more what I had mind: I was looking for a way to authenticate some of my end points using a digest-based scheme. I stumbled on Amazon's API authentication scheme, but I have the impression they are inventing their own standard (which is something I hope to avoid). Looking further, In short, something which allows me to specify that for some endpoints, something like:
is required in the request header. (apologies if my terminology gets unclear ~ as you can probably guess, I'm not a cryptography expert ;) ). |
No worries. It's been a long time since I've read up on Digest authentication so will have to go over it again at some point. If you already know, what is the value given as the |
The contents itself, when defined, is the hash. What needs to be hashed depends on the value of other optional keys as well (section 3.2.2.1). |
Right, but the question is whether the spec (Swagger) needs to define which key-values are required for the Digest authentication scheme, as for the values, what they need to contain. |
If there are suggestions on how to generalize a HMAC implementation I think we'd be happy to include it in the next rev of the spec. All the mechanisms are there to automatically generate the hashes. |
@webron If I can say, I'd try to be as close as possible to the RFC. However, the RFC keys seems to have quite complex dependencies among each other (e.g. This could complicate things when If these two alternatives are too complicated, maybe it's simply simpler to update the swagger spec with a more general |
It would be nice to see something a bit more free-form and generic implemented here. Perhaps it would be sufficiently flexible to allow the API spec authors to define which parameters, and their formats, are required for the hash inputs. This would be able to support HMAC-like schemes such as Hawk. Something like this:
|
Not sure if this is directly applicable or not, but there is an IETF RFC draft that adds support to retrieving resources using MAC tokens to Oauth2. |
I second this request, as I need this for my project -- would be awesome to have support for this in Couldn't you just do something fairly simple + generic here? I'm thinking it could be done by allowing one to specify a callback JavaScript function that receives the outbound request and allows the function to modify / sign it before being sent. Possibly as simple as adding a new {
"type": "custom",
"callback": "function (req) { /* manipulate request on the way out */ }"
} To support it in the editor, the callback would have to be This way, the spec punts the implementation and allows the api designer to implement whatever signing protocol they intend to use. |
I second @bow suggestion on having an quick way to support Authorization Header with custom security scheme. This could be a better starting point. This can further evolve into what @who has suggested. This is more robust and complete support for such authentication mechanisms. Going through the following SO questions and Amazon suggested implementation of this approach, IMHO, the above two could be a better way forward http://stackoverflow.com/questions/454355/security-of-rest-authentication-schemes http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html |
This should probably be associated #585 |
@webron Definitely interested in helping this move forward. Many of the projects on which I work will need an HMAC authentication mechanism. I'd be glad to put together real-world use cases for this. If those would be useful, where would one contribute them? Should I just create a gist/md with nicely-formatted explanations and examples? |
@who - sure, gists would be great. Anything that helps clarifying and moving the discussion forward. |
pr #807 now allows you to identify any HTTP scheme in the security definition. There are so many different variants of how HMAC tokens are generated, it would be problematic to try and specify all possibilities. |
We've done what we could :) |
hi guys, |
I need this feature as well. |
Hi Guys, |
Hello, Do we have any plan about this definition in the OpenAPI spec? Here are some documents found, but looks like there are not standard, if there are some rfc links for reference, please let me know it, much appreciated. https://docs.microsoft.com/en-us/azure/azure-app-configuration/rest-api-authentication-hmac |
Bump, this is really needed. |
Still needed, for years. HMAC-SHA512 is widely used. |
The current spec (v2.0) defines three valid security schemes: basic HTTP authentication, authentication using an API key, and Oauth2.
What seems to be nonexistent is an HMAC-based authentication scheme. Are there any plans to add such a scheme in the upcoming versions of the spec?
The text was updated successfully, but these errors were encountered: