Repository navigation
Dynamic Passwords in NpgsqlConnection - #2502
Conversation
New connections will execute the delegate to obtain a password. This allows the use of dynamic passwords or tokens such as those used by Amazon RDS IAM Authentication. #2500
It's possible that the username is not directly taken from the connection string, so flow the computed username down so it is available in the delegate. #2500
|
The critical design decision here is to not allow fallback to the password specified on the connection string or to a PassFile. I think that if you are defining the delegate and you want to return null that is your responsibility to handle. Falling back into other authentication methods would be confusing in this case i believe |
roji
left a comment
There was a problem hiding this comment.
Looks good! See below comments in addition to @YohDeadfall:
- I don't really see the reason to call this a "dynamic" password - it's just a callback-based mechanism.
- Is there a specific reason to ignore Password on the connection string if a delegate is provided? Why not have the delegate just be a fallback when the password isn't specified, just like PgPass is handled? I could imagine scenarios where some fallback delegate is wired up, but a user may want to provide a password manually...
This aligns this property with the existing delegates ProvideClientCertificatesCallback and RemoteCertificateValidationCallback #2500
roji
left a comment
There was a problem hiding this comment.
Looking very close, thanks for your work. Let me know if anything is unclear.
|
no problem, these tweaks are all very easy |
|
let me know if you would like all these commits rebased and squashed to have a sane linear history, rather than showing the journey we came on |
roji
left a comment
There was a problem hiding this comment.
I'm good to merge. @YohDeadfall can you please give this a quick review?
|
@williamdenton yeah please squash this to a single commit in preparation for merge. |
YohDeadfall
left a comment
There was a problem hiding this comment.
Looks good except a few nits which I can't comment in the code (Windows Phone Edge is no more supported supported by GitHub), so will write my comments here.
- In line 385 in the
GetPasswordmethodGetDynamicPasswordmentioned, but there is no such delegate. - In the same method in line 392 there is a naming issue too. Probably you want to say
Obtaining password using {nameof(GetPasswordCallback)} delegate failed.?
|
@roji do you want a single commit, or two or three with the critical steps split out. For example we have made some changes to the passfile implementation that were done as we're in the vicinity, not directly related to this issue. |
|
Personally I prefer to separate fixes from features to keep things clear, but as I know Shay likes to squash everything into a single commit. |
New connections will execute the delegate to obtain a password. This allows the use of dynamic passwords or tokens such as those used by Amazon RDS IAM Authentication. Fixes #2500
|
I think things here are related and small enough to make a single commit reasonable... Merged via d78f3d6. @williamdenton thanks for your contribution! It's a nice new feature for Npgsql, hope we'll see more from you in the future :) |
|
As I said, Shay likes single commit changes (: Yep, thank you! And it's great to see documentation changes. |
|
@YohDeadfall knows me too well :) |
austindrenski
left a comment
There was a problem hiding this comment.
A bit late to the party, but awesome to see this merged. Thanks for your contribution! 🎉
|
When will this likely make it into a nuget? Guessing it's in the 4.1 release. I might prepare a blog post to go with this. |
It'll definitely be part of the 4.1 release, which I would expect to see this calendar year. (@roji may have a more specific timeline in mind.) Of course, in the meantime, it should already be available from the
Please let us know if you do! We've linked to related blog posts in past release notes, so I'm sure we could take a look at whatever you put together. |
Currently I'm a blocker here because of unfinished work on type handlers. |
|
The idea is to more or less synchronize the next release (which we may end up calling 5.0) with .NET Core 3.0, which is due this year. |
Semver wise 0af8c1d is a breaking change which means this isn't 4.1 - its definitely 5.x. |
|
Oh, there are other more important ones for sure :) |
See #2500