valkey-io / valkey-glide

An open source Valkey client library that supports Valkey and Redis open source 6.2, 7.0 and 7.2. Valkey GLIDE is designed for reliability, optimized performance, and high-availability, for Valkey and Redis OSS based applications. GLIDE is a multi language client library, written in Rust with programming language bindings, such as Java and Python
Apache License 2.0
260 stars 53 forks source link

Add support for changing credentials on an existing client #2360

Open nakedible-p opened 1 month ago

nakedible-p commented 1 month ago

Describe the feature

There should be a way to assign new credentials to an existing client object and have those new credentials used for any subsequent connections or reauthentications of existing connections.

Use Case

AWS MemoryDB requires an authentication token that has a lifetime of 15 minutes. This means the password given when the client is created will be invalid after 15 minutes. If the client reconnects any connections after the 15 minute timeout, those connections will fail with WRONGPASS.

Proposed Solution

Perhaps just "set_credentials()" call, or "update_credentials()" or just making the credentiantials a setter that will write the credentials to the Rust side.

Other Information

A possibly better, but more complex, alternative to this would be supporting "credential providers", so some async function that is called every time there is a need to generate credentials for an AUTH command. Another alternative is just direct MemoryDB support, which is less flexible.

Acknowledgements

Client version used

1.1.0

Environment details (OS name and version, etc.)

Node.js

asafpamzn commented 1 month ago

Added to 1.2 release.