swagger-api / swagger-api/swagger-codegen-generators

Certificate keypasswd support

Open
#885 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Description

The current handlebar templates do not provide the capability of setting a client certificate passphrase.

When generating a client SDK that makes use of client certificates there isn’t a configuration variable that can be set in the configuration.mustache and associated Typhoues keypasswd in the api_client.mustache templates to define and use a cert passphrase.

Swagger-codegen version

Swagger Codegen 3.0.0

Related issues/PRs

Issue: Certificate keypasswd support
PR: Add support for passing client key password (keypasswd). Added logic …

Suggest a fix/enhancement
Handlebar template - configuration.mustache

Add the following to the template:

    ### TLS/SSL setting
    # Client private key passphrase (for client certificate)
    attr_accessor :key_password

    def initialize
      ...
      @key_password = nil
      ...
    end
Handlebar template - api_client.mustache

Add the keypasswd to the Typhoeus::Request req_opts collection:

      req_opts = {
        :method => http_method,
        :headers => header_params,
        :params => query_params,
        :params_encoding => @config.params_encoding,
        :timeout => @config.timeout,
        :ssl_verifypeer => @config.verify_ssl,
        :ssl_verifyhost => _verify_ssl_host,
        :sslcert => @config.cert_file,
        :sslkey => @config.key_file,
        :verbose => @config.debugging,
        :keypasswd => @config.key_password
      }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the configuration.mustache and api_client.mustache templates in the generated Ruby client. Trace how certificate and key settings are exposed and passed into Typhoeus::Request, then verify that the generated client can configure and use a client certificate passphrase.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.