Skip to content

Fix websocket tls options - #41

Merged
brendandburns merged 2 commits into
kubernetes-client:masterfrom
sheldonkwok:fix/websocket-tls
Apr 28, 2018
Merged

Fix websocket tls options #41
brendandburns merged 2 commits into
kubernetes-client:masterfrom
sheldonkwok:fix/websocket-tls

Conversation

@sheldonkwok

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread node-client/src/config.ts Outdated
opts.key = this.bufferFromFileOrString(user.keyFile, user.keyData);
}

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@brendandburns

Copy link
Copy Markdown
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