OpenAPITools / OpenAPITools/openapi-generator
[REQ] Java jersey OAuth2 add support for public client
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java and auth/OAuth.java, focusing on the existing credential methods referenced in the issue. Compare the proposed API with PR #13828 and verify that a generated jersey3 Java client can configure a public OAuth2 client using only a clientId, without requiring a clientSecret.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, authentication
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100