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

feat(security): add cookie-auth support #240

Merged
merged 1 commit into from
Jun 8, 2018

Conversation

matteomazza91
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: Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

It adds cookie-auth support as specified in the spec

It relates to issue #208

Test performed

run the codegen with -DdebugOperations=true on an OpenAPI spec file with cookie auth.

input:

...
securitySchemes:
  user_creator:
    type: apiKey
    in: cookie
    name: JSESSIONID
....

output:

...
"authMethods" : [ {
    "name" : "user_creator",
    "type" : "apiKey",
    "hasMore" : false,
    "isBasic" : false,
    "isOAuth" : false,
    "isApiKey" : true,
    "vendorExtensions" : { },
    "keyParamName" : "JSESSIONID",
    "isKeyInQuery" : false,
    "isKeyInHeader" : false,
    "isKeyInCookie" : true,
    "isCode" : false,
    "isPassword" : false,
    "isApplication" : false,
    "isImplicit" : false
  } ]
....

@wing328
Copy link
Member

wing328 commented Jun 7, 2018

@matteomazza91 thanks for the enhancement, which looks good to me.

@jimschubert
Copy link
Member

Looks good, I didn't run to try it out.

I wanted to comment that we discussed in the linked issue of possibly validating/verifying that the spec (if 2.0) supported the cookie API feature. We decided that it would be better to validate on generation by default, which avoids lots of conditional branches evaluating feature sets between spec versions. I have added the validation on generation as part of #251.

@wing328 wing328 merged commit ebaa702 into OpenAPITools:master Jun 8, 2018
jimschubert added a commit to jimschubert/openapi-generator that referenced this pull request Jun 12, 2018
* master: (26 commits)
  Prepare 3.0.1 release (OpenAPITools#280)
  [typescript-angular] strict type checking (OpenAPITools#218)
  [C++ server] Adjust the names (script, sample folder, generator) to lang option (OpenAPITools#250)
  Removed warnings for packages included in SDK for Net Core 2.0 (OpenAPITools#269)
  [cli] Completions command for suggestions (OpenAPITools#213)
  [Java][RestTemplate] Fix query parameter URL encoding (OpenAPITools#260)
  [cpp-qt5] Remove std::shared_ptr from Qt5 (OpenAPITools#267)
  Adds some links to the README (OpenAPITools#261)
  Update sec.gpg.enc to binary encoded secret
  Add gpg --check-trustdb, limit gpg to master
  Re-do encrypted gpg and reference in settings.xml
  Fix trailing semicolons in after_success Travis CI scripts
  Use ubuntu keyserver instead of mit (due to timeout)
  [gradle] Plugin release management (OpenAPITools#201)
  Updates small typo in qna.md (OpenAPITools#262)
  Fix ModelUtils.getUnusedSchema() (OpenAPITools#253)
  Add JaxRS to bin/ensure-up-to-date (OpenAPITools#248)
  feat(security): add cookie-auth support (OpenAPITools#240)
  Add 'unblu inc.' to company list (OpenAPITools#246)
  put company list in alphabetical order (OpenAPITools#244)
  ...
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.

None yet

3 participants