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

Fix websocket tls options #41

Merged
merged 2 commits into from
Apr 28, 2018

Conversation

sheldonkwok
Copy link
Contributor

No description provided.

opts.ca = this.bufferFromFileOrString(cluster.caFile, cluster.caData);
opts.cert = this.bufferFromFileOrString(user.certFile, user.certData);
opts.key = this.bufferFromFileOrString(user.keyFile, user.keyData);
}

private applyAuthOptions(opts: request.Options | https.RequestOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applytoHTTPsOptions and applyToRequest both add some form of "auth" by using HTTP Basic Auth.

Consider renaming this function applyAuthorizationHeader to indicate its limited scope.

Alternatively, consider modifying applyAuthOptions to apply HTTP Basic Auth to either type of input. If it's a https.RequestOptions, we'll want to

opts.auth = `${user.username}:${user.password}`;

If it's a request.Options, we'll want to

opts.auth = { username: user.username, password: user.password }

though I'm not sure how to convince the compiler that you can safely do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could dig around for a fixed key in request.Options to create a type guard assertion but I changed the name for now.

Fix indentation on user.token

Rename applyAuthOptions to applyAuthorizationHeader
@brendandburns
Copy link
Contributor

This generally looks ok to me, but I'd love some unit tests for the new behavior...

@brendandburns
Copy link
Contributor

LGTM, thanks!

@brendandburns brendandburns merged commit 9dd11ac into kubernetes-client:master Apr 28, 2018
@sheldonkwok sheldonkwok deleted the fix/websocket-tls branch February 5, 2019 23:12
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.

3 participants