-
Notifications
You must be signed in to change notification settings - Fork 28
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
SNOW-715510: MFA Token cache for libsnowflakeclient #773
base: master
Are you sure you want to change the base?
SNOW-715510: MFA Token cache for libsnowflakeclient #773
Conversation
|
||
if (errno == EEXIST) | ||
{ | ||
CXX_LOG_TRACE("Directory already exists %s directory.", dir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: second directory is probably obsolete in this sentence
"TMP" | ||
}; | ||
|
||
const std::vector<std::string> CACHE_DIR_NAMES = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Effectively we want to create or find .cache/snowflake directory so it's one path right? The fact that CACHE_ROOT_ENV_VARS
provides alternatives while CACHE_DIR_NAMES
contains parts of the same path confused me a bit. Maybe we can rename to CACHE_DIR_PATH
?
|
||
std::string credItemStr(const CredentialKey &key) | ||
{ | ||
return key.host + ":" + key.user + ":SNOWFLAKE-ODBC-DRIVER:" + credTypeToString(key.type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be hardcoded to ODBC-DRIVER? I wonder if there's some way to determine whether libsfclient is executed within ODBC or PHP driver or possibly even other drivers in the future.
ensureObject(cache); | ||
picojson::object &obj = cache.get<picojson::object>(); | ||
auto pair = obj.emplace(key.account, picojson::value(picojson::object())); | ||
auto accountCacheIt = pair.first; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Here I also wasn't sure why we're calling pair.first then accountCacheIt->second gets the credential value. I admit it's a skill issue but would appreciate getting verbose type instead of auto either here or for pair
/** | ||
* storeToken | ||
* | ||
* API to secure store credential in Apple Keychain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or Windows Credential Manager?
#include <sstream> | ||
|
||
#define MAX_TOKEN_LEN 1024 | ||
#define DRIVER_NAME "SNOWFLAKE_ODBC_DRIVER" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern as above
No description provided.