swagger-codegen-generators icon indicating copy to clipboard operation
swagger-codegen-generators copied to clipboard

Certificate keypasswd support

Open georgedias opened this issue 4 years ago • 0 comments

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
      }

georgedias avatar Apr 06 '21 18:04 georgedias