Skip to content

[REQ] Java jersey OAuth2 add support for public client #13827

@sbilz

Description

@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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions