-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Modified "Make HikariConfig able to retrieve passwords dynamically from a password supplier" #1335
base: dev
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1335 +/- ##
============================================
+ Coverage 74.65% 74.72% +0.07%
- Complexity 545 549 +4
============================================
Files 23 23
Lines 1929 1935 +6
Branches 263 263
============================================
+ Hits 1440 1446 +6
Misses 345 345
Partials 144 144
Continue to review full report at Codecov.
|
Perfect! I made a fork with this change and works very well 💯 |
Thanks a lot @relaxkeren for your work! There are two remarks I like to share.
|
@simonkoennecke Going back to the comments on #1196, what is insufficient about using the MBean interface to alter the username/password as they user sees fit, on any schedule or by any algorithm they desire? |
This will be very useful for us. But why not also do the same for the username? As someone in the original PR mentioned, for cases when an alternate username is used (e.g., alongside AWS SecretsManager), I will also need to switch the username. A CredentialsSupplier for both username and password would be ideal. |
@brettwooldridge The main difference is that when using IAM Authentication for jdbc connections, the recommended approach is to simply generate a new 15-minute temporary password for every new physical connection. This is a simple and straight forward approach to using a more secure way to authenticate. On the other hand, using the MXBean approach does not satisfy the simple use-case of using a new temporary password on every new physical connection. Instead, the user (or every user who is interested in this), will need to write plumbing code to have a background thread that wakes up periodically to update the temporary password. This will result in a lot of plumbing code required for all users who want to do this, as well as increase the complexity of their applications. I would argue that most junior developers who attempt to use background threads will trip and fall into the many pitfalls that comes with background threads (eg, they don't catch all exceptions in the background thread, and somehow an exception is thrown and the thread dies and the developer will be left clueless with a production p0 issue). By allowing this feature, it will be beneficial to developers because all these complexity will no longer be need. Simplicity is the best. Edit: I reckon that you probably have a very good reason to perform this action, but it limits developers from further extending this project without coming here to post an issue. |
At the very least the MXBean should be extended to provide a method to set both the username and password atomically. As mentioned, using the MXBean for dynamic configuration is ... awkward. A CredentialSupplier would be a simple and elegant addition to the API to address these needs. |
I am exploring Hikari to use in one of my applications. I have a requirement to retrieve password dynamically from password supplier like cyber ark vault. Could you please help me to achieve this using Hikari. I am very new to using Hikari. |
Made some comments about this issue in the other pull request in case it helps anyone! |
Is this likely to be added any time soon? This appears to still be an unsolved issue 3 years on. Or does anyone else have a better workaround? |
If the use case of the feature is AWS IAM authentication, then I recommend looking at this JDBC driver: https://github.com/awslabs/aws-advanced-jdbc-wrapper. |
6d319ab
to
7cacd0f
Compare
It's a modified PR from https://github.com/brettwooldridge/HikariCP/pull/1196/files. To avoid maintaining password and password supplier both together, this PR makes password setting more generic. Try to keep the simplicity while adding more extensibility for more db settings