Skip to content
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

[okhttp-gson] Add support for OAuth access token retry #1058

Merged
merged 5 commits into from
Sep 20, 2018

Conversation

Kiran-Sivakumar
Copy link
Contributor

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.3.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

@bbdouglas @JFCote @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger
This adds support for OAuth access token retry logic to the OkHttp-gson Java library.

This implements a similar solution to the one used in the retrofit library: 69d956f.

Changes:

  • ApiClient.mustache
    • ApiClient constructor added to allow for necessary access token retry information to be initialized (if user wants token retry support). This constructor is only generated if OAuth is being used.
    • Added getter for token end point (TokenRequestBuilder).
  • OAuthOkHttpClient class generated under auth/ to perform access token retry requests.
  • RetryingOAuth class generated under auth/ to perform access token retry logic; implements the okhttp Interceptor interface (clean and modular).
  • Dependencies added for maven and gradle.
  • Samples updated.

fix #1057

Copy link
Member

@wing328 wing328 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me although I've not tested it locally

@wing328 wing328 added this to the 3.3.0 milestone Sep 19, 2018
@wing328 wing328 merged commit 0e045be into OpenAPITools:master Sep 20, 2018
jaumard pushed a commit to jaumard/openapi-generator that referenced this pull request Sep 21, 2018
…1058)

* Add support for access token retry in okhttp-gson lib

* Update expected number of generated files in test

* Update samples

* Update security samples

* Fix default user-agent and update samples
@wing328
Copy link
Member

wing328 commented Oct 2, 2018

@Kiran-Sivakumar thanks again for the PR, which is included in the v3.3.0 minor release: https://twitter.com/oas_generator/status/1046941449609068544

@Kiran-Sivakumar Kiran-Sivakumar deleted the retry branch October 25, 2018 21:01
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
…1058)

* Add support for access token retry in okhttp-gson lib

* Update expected number of generated files in test

* Update samples

* Update security samples

* Fix default user-agent and update samples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[okhttp-gson] Add Support for OAuth Access Token Retry
2 participants