Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13827
Closed
Open
Issue created Oct 26, 2022 by Administrator@rootContributor

[REQ] Java jersey OAuth2 add support for public client

Created by: sbilz

Is your feature request related to a problem? Please describe.

In our project we use the the openApiGenerator to generate a client with OAuth2 password-flow-support, with library="jersey3" and generatorName="java". By now there is no direct way to use a a public client (client with clientId, but without secret, compare https://www.oauth.com/oauth2-servers/definitions/). We have fixed the problem for us by using mustache-templates but we think that the community could also benefit from this extension.

Example: ApiClient.setOauthCredentials(String clientId, String clientSecret) compare https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java#L523 OAuth.setCredentials(String clientId, String clientSecret, Boolean debug) needs clientSecret (if empty String is used this is prevent by com.github.scribejava.core.builder.ServiceBuilder, which checks this Precondition and throw an IllegalArgumentException in this case) compare https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/auth/OAuth.java#L159

Describe the solution you'd like

We suggest a new method, which does not require the clientSecret as described above. ApiClient setOauthCredentialsForPublicClient(String clientId) compare PR #13828

Describe alternatives you've considered

Temporarily we are using mustache-templates as described above.

Assignee
Assign to
Time tracking