Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sfc-gh-jszczerbinski
Copy link
Contributor

No description provided.


if (errno == EEXIST)
{
CXX_LOG_TRACE("Directory already exists %s directory.", dir);
Copy link
Contributor

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 =
Copy link
Contributor

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);
Copy link
Contributor

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;
Copy link
Contributor

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
Copy link
Contributor

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants