Repository navigation
Conversation
Use ProvidePasswordCallback to dynamically provide the password on demand. Use 'using' declarations to dispose resources.
roji
left a comment
There was a problem hiding this comment.
LGTM.
Am not familiar with AWS authentication - is a unique token supposed to be generated for each and every individual connection? Or should users cache a single token and only rotate it after some time? If it's the latter, the callback could do that as well. But either way, the code is good as-is.
|
Each token is valid for 15 minutes, but because of pooling it's best to generate a new one on demand when the Connection requires it. Once the connection is open and in the pool it's not called again. It doesn't matter about the 15 minute lifetime once the connection is open. If you're using this in a multi threaded app like an http api, and you add a log statement inside the call back, you'll see a flurry of executions as the app starts but once stable and the connection pool is populated very rarely does it ever open a new physical connection. (I realise that both of you probably know his this works, I thought I would add some commentary for anyone else looking at this pr) |
|
Thanks for the detail @williamdenton. Definitely better to use the callback rather than to specify the token on the connection string, since as @bgrainger explained, the latter means that pooling is effectively off, since each connection string gets its own pool. |
|
Closing this issue or pull request in advance of archiving this repo. For more information about the decision to archive this repo (and others in the 'awsdocs' org), see the announcement on the AWS News Blog. |
ProvidePasswordCallbackto dynamically provide the password on demand.usingdeclarations to dispose resources.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.