-
-
Notifications
You must be signed in to change notification settings - Fork 26
allow for externally managed token files #17
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ class Config { | |
|
||
static Config *Get(); | ||
|
||
bool external_token_manager() const { return external_token_manager_; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we call this "manage_token_externally"? |
||
std::string client_id() const { return client_id_; } | ||
std::string client_secret() const { return client_secret_; } | ||
bool log_to_syslog_on_failure() const { return log_to_syslog_on_failure_; } | ||
|
@@ -42,6 +43,7 @@ class Config { | |
|
||
std::string client_id_; | ||
std::string client_secret_; | ||
bool external_token_manager_ = false; | ||
bool log_to_syslog_on_failure_ = true; | ||
bool log_full_trace_on_failure_ = false; | ||
std::string token_endpoint_ = "https://accounts.google.com/o/oauth2/token"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"external_token_manager": "no", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to leave this out of the sample config file, since I imagine most users won't need it and I'd like to avoid the confusion. |
||
"client_id": "CLIENT_ID_GOES_HERE", | ||
"client_secret": "CLIENT_SECRET_GOES_HERE" | ||
} |
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.
I think it's cleaner overall if instead of having two different code paths here, in
Client
, we push this complexity intoTokenStore
by adding a flag there that just disables refreshes.Client
would remain unmodified except that it passes the value ofmanage_token_externally
toTokenStore
, andTokenStore
would just always return whatever's in the token file, regardless of the expiry time.