-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[CORE] Add support for HTTP signature #4993
Conversation
modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
Show resolved
Hide resolved
Copy/paste of discussion that occurred in Slack: Jim Schubert Sebastien Rosset 4 days ago Sebastien Rosset 4 days ago Jim Schubert 4 days ago Jim Schubert 4 days ago Sebastien Rosset 4 days ago |
There is a build failure because of unrelated PHP uncommitted file:
This requires changes from #5001 |
Initially I added the new 'http signature' auth scheme to the existing petstore-with-fake-endpoints-models-for-testing.yaml. But then after running the scripts to generate PHP code, I hit a new issue that I have opened: #5025. IMO, all generators should have the following logic: if the security scheme type is "http", then inspect the value of the "scheme" attribute. If the "scheme" is "basic", then generate the code for http basic authentication. If the value of the "scheme" is unknown to this particular generator, then don't generate anything. As a workaround, I have copied a new YAML file modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml. Its content is the same as modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml, with a few lines changed to specify HTTP signature. That file can be used for the python and golang generators. Then when #5025 is fixed, we can remove the file. |
The diff in samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml seem to be completely unrelated. |
Thanks for this work! |
the signature scheme was added by OpenAPITools#6058 for jersey2-experimental (now jersey2-java8) only but this change affected all samples; and it was not removed when there is another special yaml file with http-signature-test (OpenAPITools#4993) was introduced
the signature scheme was added by OpenAPITools#6058 for jersey2-experimental (now jersey2-java8) only but this change affected all samples; and it was not removed when there is another special yaml file with http-signature-test (OpenAPITools#4993) was introduced
+ remove http signature from test input yaml when not supported + use http-signature file for python-nextgen and python-legacy instead of standard test input file the signature scheme was added by OpenAPITools#6058 for jersey2-experimental (now jersey2-java8) only but this change affected all samples; and it was not removed when there is another special yaml file with http-signature-test (OpenAPITools#4993) was introduced
+ remove http signature from test input yaml when not supported + use http-signature file for python-nextgen and python-legacy instead of standard test input file the signature scheme was added by OpenAPITools#6058 for jersey2-experimental (now jersey2-java8) only but this change affected all samples; and it was not removed when there is another special yaml file with http-signature-test (OpenAPITools#4993) was introduced
This is adding a new "HTTP signature" security schemes (https://datatracker.ietf.org/doc/draft-cavage-http-signatures/)? HTTP signatures is still a IETF draft, and hopefully it will become an official RFC this year. On one hand one may argue it shouldn’t be added because it’s still a draft, but on the other hand it is already being used by multiple products, so there may be benefits to support it. It is possible multiple organizations are independently adding the same security scheme.
Ideally one way to address the problem would be to make it possible to add new security schemes (such as HTTP signature) without being required to fork the OpenAPITools repo. But given the current code structure, it’s not clear to me how this could be achieved. Adding new security schemes involves surgery in multiple locations (Java codegen, templates, mustache tags).
I raised this point in Slack before opening the PR.
I suggest merging #5049 before this PR.
PR checklist
./bin/
(or Windows batch scripts under.\bin\windows
) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the code or mustache templates for a language ({LANG}
) (e.g. php, ruby, python, etc).master
,4.3.x
,5.0.x
. Default:master
.