Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support host aliases in client certificate configuration #1117

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mpcjanssen
Copy link

We are using an enterprise service bus where different users have different authorisations and use different client certificates. So I need to be able to configure multiple client certificates for the same host.

This PR allows changing the host of the http request in the certificate settings so one can define an alias for every different certificate on the same host.

Another option to achieve the same effect would be to be able to define a certificate on every request but that is a bigger change and requires more duplication in the http files themselves.

Example use:

config.json

{
    "rest-client.certificates": {
        "esbnode_certa": {
            "hostname": "esbnode",
            "pfx": "user_a.p12",
            "passphrase": "pw_a"
        },
        "esbnode_certb": {
            "hostname": "esbnode",
            "pfx": "user_b.p12",
            "passphrase": "pw_b"
        }
    }
}

And then in the http file:

### with cert a
GET https://esbnode_certa/operation

### with cert b
GET https://esbnode_certb/operation

@nt126716
Copy link

Hi @mpcjanssen
Instead of having hostname in certificate block, can we have requestUrl as below

{
    "rest-client.certificates": {
        "certa": {
            "requestUrl": "https://example.com/path1",
            "pfx": "user_a.p12",
            "passphrase": "pw_a"
        },
        "certb": {
            "requestUrl": "https://example.com/path2",
            "pfx": "user_b.p12",
            "passphrase": "pw_b"
        }
    }
}

And then users can simple use regular syntax or can follow the same syntax of having per-request settings standard as
Regular Syntax:

GET https://example.com/path1/operation

###
GET https://example.com/path2/operation

Per-request settings:

# @cert certa
GET https://example.com/path1/operation

###
# @cert certb
GET https://example.com/path2/operation
GET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants