You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see, in the init method, the authentication map is initialized and locked with Collections.unmodifiableMap.
Since it’s a private field, even extending the class doesn’t allow adding other authentication methods unless I use reflection (which I’d like to avoid, as it defeats the purpose of using this type of tool).
Manually changing the implementation of the generated client doesn’t seem practical either, as it would undermine the whole purpose of client code generation.
Questions:
What is the correct way to use these authentication methods?
What’s the point of making init a protected method, given that it doesn’t seem to provide practical extensibility in this case?
Thank you in advance for your support!
NOTE: openapi-generator version: 7.10.0
The text was updated successfully, but these errors were encountered:
Hello everyone,
I’m looking for support regarding the generation of a Java client using
RestTemplate
.Below, I’ll share the command I used to generate the client:
In my case, I attempted to generate clients for the following APIs:
Now, I have a few questions about handling authentication in the invoker. Specifically, let’s start with the following interface:
This interface is extended by several implementations:
HttpBasicAuth
HttpBearerAuth
ApiKeyAuth
OAuth
My main question is: "How can I instantiate
ApiClient
to specify the type of authentication to use?"The generated client has the following structure:
As you can see, in the
init
method, the authentication map is initialized and locked withCollections.unmodifiableMap
.Since it’s a private field, even extending the class doesn’t allow adding other authentication methods unless I use reflection (which I’d like to avoid, as it defeats the purpose of using this type of tool).
Manually changing the implementation of the generated client doesn’t seem practical either, as it would undermine the whole purpose of client code generation.
Questions:
init
aprotected
method, given that it doesn’t seem to provide practical extensibility in this case?Thank you in advance for your support!
NOTE: openapi-generator version: 7.10.0
The text was updated successfully, but these errors were encountered: