-
-
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
[python] bearerAuth always type basic #1577
Comments
Does #1207 address this? |
Ideally this would be something like
|
As we can find here /resources/python/configuration.mustache the bearer token will work only if the type equals |
I'm not real familiar with mustache.. Shouldn't we be able to add another block for type |
In my opinion that should be changed, as the OpenApi allows Bearer authentication without OAuth. I've tested the proposal by vmorris:
Adding this and of course the |
See OpenAPITools#457 Also OpenAPITools#1446 for typescript, OpenAPITools#1577 for python Specs defined as follows currently generate BasicAuth and send "Authorization: Basic [base64Encode(username + ":" + password)]" components: securitySchemes: bearer: type: http scheme: bearer This change will generate an OAuth header, which will send a "Authorization: Bearer [accessToken]" This is a smaller, less-impactful change than introducing a BearerAuth object, but this change doesn't support scheme values other than bearer See also OpenAPITools#1930
See OpenAPITools#457 Also OpenAPITools#1446 for typescript, OpenAPITools#1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of OpenAPITools@80ca67c This PR is an alternative to OpenAPITools#1972
Hi all, I've filed #1999 to add the Bearer authentication support to the Python client. Please review when you've time. |
#1999 merged into master. Please try the latest master (snapshot, docker image, etc). Closing this for the time being. |
* fix #457 by introducing an HttpBearerAuth object See #457 Also #1446 for typescript, #1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of 80ca67c This PR is an alternative to #1972 * update petstore samples * Update HttpBearerAuth mustache templates and samples * correct the expected number of generated java client files * update the retrofit2 HttpBearerAuth template and samples * Add resttemplate-specific HttpBearerAuth mustache and samples * add vertx-specific HttpBearerAuth template and samples * add java webclient-specific HttpBearerAuth template and samples
* fix OpenAPITools#457 by introducing an HttpBearerAuth object See OpenAPITools#457 Also OpenAPITools#1446 for typescript, OpenAPITools#1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of OpenAPITools@80ca67c This PR is an alternative to OpenAPITools#1972 * update petstore samples * Update HttpBearerAuth mustache templates and samples * correct the expected number of generated java client files * update the retrofit2 HttpBearerAuth template and samples * Add resttemplate-specific HttpBearerAuth mustache and samples * add vertx-specific HttpBearerAuth template and samples * add java webclient-specific HttpBearerAuth template and samples
@wing328 sorry it took some time for me to come back to that project. I was testing it today using the current master snapshot docker image and it works perfectly. Thanks for your work! |
is this fix released in 3.X version? in my generated code there's no
|
@esseti this went into the 4.0.0 milestone |
hey, i'm looking at a code generated for python and i see this:
openapi spec has bearer token auth on all requests pretty much |
@4c74356b41 I am not an expert on this group's preferred way to handle this, but I think you should open a new issue and reference this one. |
* fix #457 by introducing an HttpBearerAuth object See OpenAPITools/openapi-generator#457 Also OpenAPITools/openapi-generator#1446 for typescript, OpenAPITools/openapi-generator#1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of OpenAPITools/openapi-generator@80ca67c This PR is an alternative to OpenAPITools/openapi-generator#1972 * update petstore samples * Update HttpBearerAuth mustache templates and samples * correct the expected number of generated java client files * update the retrofit2 HttpBearerAuth template and samples * Add resttemplate-specific HttpBearerAuth mustache and samples * add vertx-specific HttpBearerAuth template and samples * add java webclient-specific HttpBearerAuth template and samples
* fix #457 by introducing an HttpBearerAuth object See OpenAPITools/openapi-generator#457 Also OpenAPITools/openapi-generator#1446 for typescript, OpenAPITools/openapi-generator#1577 for python Specs defined as follows currently generate BasicAuth and send an "Authorization: Basic [base64Encode(username + ":" + password)]" header components: securitySchemes: bearer: type: http scheme: bearer This change will generate code which uses a new HttpBearerAuth class, which will send a "Authorization: [scheme] [accessToken]" header. This change is slightly larger and more impactful than simply using OAuth for bearerBearer, but it allows for scheme values other than bearer. This fix was enabled by the recent commit of OpenAPITools/openapi-generator@80ca67c This PR is an alternative to OpenAPITools/openapi-generator#1972 * update petstore samples * Update HttpBearerAuth mustache templates and samples * correct the expected number of generated java client files * update the retrofit2 HttpBearerAuth template and samples * Add resttemplate-specific HttpBearerAuth mustache and samples * add vertx-specific HttpBearerAuth template and samples * add java webclient-specific HttpBearerAuth template and samples
Description
Defining security component like
When I generate a python client, the API configuration code only allows for
type: basic
.In configuration.py:
openapi-generator version
3.3.3
The text was updated successfully, but these errors were encountered: