Skip to content

CASSSIDECAR-407 Pluggable withCredentials provider for file access#318

Open
burmanm wants to merge 3 commits intoapache:trunkfrom
burmanm:secrets_change
Open

CASSSIDECAR-407 Pluggable withCredentials provider for file access#318
burmanm wants to merge 3 commits intoapache:trunkfrom
burmanm:secrets_change

Conversation

@burmanm
Copy link

@burmanm burmanm commented Feb 13, 2026

Add new settings under driver_parameters to support pluggable withCredentials provider. Add two possible implementations, ConfigProvider (which is the current implementation) and a new one, FileProvider which reads username and password from the disk.

Also deprecate the old username/password parameters, but do not remove support for them (simply transform their input to the ConfigProvider).

@frankgh frankgh self-requested a review February 13, 2026 14:57
@frankgh
Copy link
Contributor

frankgh commented Feb 13, 2026

Thanks for the patch, I will take a look at it today

…luggable withCredentials provider. Add two possible implementations, ConfigProvider (which is the current implementation) and a new one, FileProvider which reads username and password from the disk.

Also deprecate the old username/password parameters, but do not remove support for them (simply transform their input to the ConfigProvider).
Copy link
Contributor

@yifan-c yifan-c left a comment

Choose a reason for hiding this comment

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

Thanks for the patch! It is a good idea to have the auth provider pluggable.

Comment on lines +84 to +93
public String username()
{
return readSecret(usernamePath, USERNAME_PATH_PARAM);
}

@Override
public String password()
{
return readSecret(passwordPath, PASSWORD_PATH_PARAM);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It reads from the file every single time per call. Do you expect the username/password to change?

And the indentation is wrong.

Copy link
Author

Choose a reason for hiding this comment

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

I'd expect the password/username to be modifiable, yes. Same as with TLS secrets. But if you want, I can modify this to be read-once and need to restart sidecar for changes.

Why isn't there automated test for the indentations and a formatter?

Copy link
Contributor

Choose a reason for hiding this comment

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

There is an "opinionated" guide on setting up the project in IntellJ (https://github.com/apache/cassandra-sidecar/blob/trunk/CONTRIBUTING.md#integration-with-intellij-idea). It should take care of the indentation.
There is no formatter to help, if you are not using IntelliJ, ATM.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd expect the password/username to be modifiable, yes. Same as with TLS secrets.

ok. I guess it is for the scenarios such as password rotation.

Comment on lines +144 to +146
// Fallback to the old one
String username = driverConfiguration.username() != null ? driverConfiguration.username() : "";
String password = driverConfiguration.password() != null ? driverConfiguration.password() : "";
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think defaulting to empty string is the old behavior, which allows null for username and password.
The reason of defaulting to the empty string seems to only to conform the Map.of() constructor. A workaround could be wrap HashMap (which permits null value) with unmodifiable.

@yifan-c
Copy link
Contributor

yifan-c commented Mar 5, 2026

Tests are failing. please take a look

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