OpenAPITools / OpenAPITools/openapi-generator
[GO][Question] Custom auth method
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
I am trying to create a custom auth method for Go client of an application. The auth method requires either to generate a new token every request, or to do it every x minutes. The token is generated locally and its generation can throw an error.
I tried to create a custom context, similar to this used in AccessToken Authentication, but I can only provide a static value, not a value which is generated every request.
As far as I uderstand, this code: https://github.com/OpenAPITools/openapi-generator/blob/14d41310b968b47bf2a6bc89bbc9c7dadffaca06/modules/openapi-generator/src/main/resources/go/client.mustache#L332-L376 limits my possibilities to provide custom auth method.
Is there any way to workaround this? If not, are you willing to review a PR containing code allowing to create custom auth methods (and if so, how would you want it to look like)?
Thanks in advance
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 modules/openapi-generator/src/main/resources/go/client.mustache, especially lines 332-376, and compare the existing AccessToken Authentication handling described in the issue. Define the extension point needed for per-request or periodic token generation and error propagation; done means the requested custom authentication behavior is supported without relying on a static value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, authentication
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100