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 and test "psk" in client connection #4378

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions R/rdeephaven/R/client_wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ Client <- R6Class("Client",
} else {
stop("Basic authentication was requested, but 'auth_token' was not provided, and at most one of 'username' or 'password' was provided. Please provide either 'username' and 'password', or 'auth_token'.")
}
} else if (auth_type == "psk") {
if (auth_token != "") {
verify_string("auth_token", auth_token, TRUE)
options$set_custom_authentication("io.deephaven.authentication.psk.PskAuthenticationHandler", auth_token)
} else {
stop("Pre-shared key authentication was requested, but no 'auth_token' was provided.")
}
} else {
if (auth_token != "") {
verify_string("auth_token", auth_token, TRUE)
Expand Down
4 changes: 4 additions & 0 deletions R/rdeephaven/inst/tests/testthat/test_client_wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ test_that("client constructor fails nicely with bad inputs", {
Client$new(target = "localhost:10000", auth_type = "basic", username = "user", password = "pass", auth_token = "token"),
"Basic authentication was requested, but 'auth_token' was provided, as well as least one of 'username' and 'password'. Please provide either 'username' and 'password', or 'auth_token'."
)
expect_error(
Client$new(target = "localhost:10000", auth_type = "psk"),
"Pre-shared key authentication was requested, but no 'auth_token' was provided."
)
expect_error(
Client$new(target = "localhost:10000", auth_type = "custom"),
"Custom authentication was requested, but no 'auth_token' was provided."
Expand Down
Loading