-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
allow for externally managed token files #17
base: master
Are you sure you want to change the base?
Conversation
It may be preferrable to have an external mechanism manage the OAuth2 tokens, rather than having the sasl-xoauth2 plug-in do this for you. To allow for this scenario, a new config parameter "external_token_manager" was introduced. When set to true, sasl-xauth2 will use the "password" field content as the name of a file that contains the current OAuth2 token for user. No other configuration is needed for this plug-in, but an external mechanism must be in place to keep the content of that token file current at all times.
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.
Sorry it took me so long to get to this -- I somehow managed to miss the pull request.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this "manage_token_externally"?
@@ -1,4 +1,5 @@ | |||
{ | |||
"external_token_manager": "no", |
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'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.
if (!token_) return SASL_FAIL; | ||
} else { | ||
tokenfile_ = password; | ||
} |
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 into TokenStore
by adding a flag there that just disables refreshes. Client
would remain unmodified except that it passes the value of manage_token_externally
to TokenStore
, and TokenStore
would just always return whatever's in the token file, regardless of the expiry time.
It may be preferrable to have an external mechanism manage the OAuth2
tokens, rather than having the sasl-xoauth2 plug-in do this for you.
To allow for this scenario, a new config parameter "external_token_manager"
was introduced. When set to true, sasl-xauth2 will use the "password" field
content as the name of a file that contains the current OAuth2 token for the
user. No other configuration is needed for this plug-in, but an external
mechanism must be in place to keep the content of that token file current
at all times.