Skip to content

Preliminary openIdConnect support #4452

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aanno2
Copy link
Contributor

@aanno2 aanno2 commented Nov 11, 2019

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./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).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

Preliminary openIdConnect support

This is a (somewhat simplistic) approach to include some openIdConnect support into openapi-generator. As openIdConnect is simply a specialization of OAuth2 [1], I extented CodegenSecurity to include the isOpenIdConnect field. If this field is set to true, isOAuth is also set true.

Openid retrieves most information from openIdConnectUrl [2]. The JSON available at this URL is specified by the discovery protocol [3]. In the new Class OpenIdConnect, I retrieve the information and construct CodegenSecurity objects from it. This means that the openIdConnect discovery stuff is mainly consumed as OAuth2 flows (that are already handled by openapi-generator).

This should be enough to fix #4406 and similiar bugs were the fix is simply to treat openIdConnect as some sort of OAuth2.

Certainly this solution could be extended (later) for more openIdConnect specific stuff.

[1] https://blog.runscope.com/posts/understanding-oauth-2-and-openid-connect
[2] https://swagger.io/docs/specification/authentication/openid-connect-discovery/
[3] https://openid.net/specs/openid-connect-discovery-1_0.html

@aanno2 aanno2 changed the title initial Preliminary openIdConnect support Nov 11, 2019
@wing328
Copy link
Member

wing328 commented Nov 12, 2019

Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors.

Let me know if you need help fixing it.

Ref: https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-can-i-update-commits-that-are-not-linked-to-my-github-account

@aanno2
Copy link
Contributor Author

aanno2 commented Nov 13, 2019

@wing328:
Thank you for your comment, I've updated and merge-squashed my PR with an appropriate author email.

aanno2 added a commit to aanno2/openapi-generator that referenced this pull request Nov 13, 2019
@aanno2 aanno2 force-pushed the feature/pr-aanno2-oidc branch from 6560ce1 to 4256263 Compare November 13, 2019 15:28
@wing328
Copy link
Member

wing328 commented Nov 14, 2019

Looks like it's causing issues. E.g. haskell client generator:


ERROR: Failed to run haskell-http-client
--
5961 | java -jar ./modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g haskell-http-client -o /tmp/openapi-generator-test-fake-petstore/2.0/haskell-http-client

Ref: https://cloud.drone.io/OpenAPITools/openapi-generator/2464

@wing328
Copy link
Member

wing328 commented Nov 18, 2019

@aanno2 can you please file a PR (or update this PR) to include only the enhancements without updating all the samples to start with? That will make it easier to review and accept your PR.

@aanno2
Copy link
Contributor Author

aanno2 commented Dec 2, 2019

@wing328: As requested I have updated this PR (a) to the current master and (b) removed the modifications of samples.

@aanno2 aanno2 force-pushed the feature/pr-aanno2-oidc branch from dd74b3a to 6525d0d Compare January 22, 2020 14:55
@aanno2
Copy link
Contributor Author

aanno2 commented Jan 22, 2020

I have rebased the PR onto the current master branch.

@wing328 wing328 modified the milestones: 4.2.3, 5.0.0, 4.3.0 Jan 31, 2020
@wing328
Copy link
Member

wing328 commented Mar 1, 2020

@aanno2 can you please resolve the merge conflicts when you've time?

@wing328 wing328 modified the milestones: 4.3.0, 4.3.1 Mar 27, 2020
@aanno2 aanno2 force-pushed the feature/pr-aanno2-oidc branch from e736983 to eca2018 Compare April 30, 2020 07:29
@aanno
Copy link
Contributor

aanno commented Apr 30, 2020

@wing328: rebased to master (and sorry for being late)

@wing328 wing328 removed this from the 4.3.1 milestone May 6, 2020
@micbar
Copy link

micbar commented Dec 16, 2022

What are the plans with this? openIdConnect is a well established standard. What are the reasons why this PR seems to be stale since 2 years?

@aanno
Copy link
Contributor

aanno commented Dec 19, 2022

I've got no clue why this has not been merged in time. I have written the changes for a professional project of mine that is still in production. But I even wonder if it is still relevant.

Well, I did it as aanno2 (still me) because I had problems to use my normal account due to strange security constraints at my former working place.

@micbar
Copy link

micbar commented Dec 19, 2022

IMHO openIDConnect is an important industry standard.

@jtama
Copy link
Contributor

jtama commented May 3, 2023

Are you planning on merging this ? OIDC is widely used, and the lack of it's support is a real pain.

@Soufian20
Copy link

Any updates for that ticket?

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.

[REQ] [typescript-angular]: Support securityScheme type 'openIdConnect' like type 'oauth2' is already supported
6 participants