-
Notifications
You must be signed in to change notification settings - Fork 480
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
Add oAuthEndpoint to _oAuthClients cache key #6298
Conversation
Pull Request Test Coverage Report for Build 301650
💛 - Coveralls |
@@ -1408,6 +1407,8 @@ protected virtual async Task<OAuthClient> CreateOAuthApiClientAsync(ITurnContext | |||
OAuthClientConfig.EmulateOAuthCards = true; | |||
} | |||
|
|||
var oAuthEndpoint = OAuthClientConfig.OAuthEndpoint; |
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.
The assumption is that we should not be calling these from different threads as we are still caching a static variable. A context switch before this line could result in incorrect endpoint being used if two threads set it to different values. I wonder if the approach is to do better documentation or improve synchronization here? Thoughts?
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.
Yes, there will always be a race when using a static like this. As long as we're setting it globally via an FCB I don't think it will matter. For this PR, I wanted to minimize changes and get something that will allow us to change it globally. If we end up needing to set the value on a per-call basis then we'll need another PR to redesign the API and remove the static.
* Add oAuthEndpoint to _oAuthClients cache key * Add CreateOAuthClientWithDifferentEndpoints test Co-authored-by: Craig Jensen <crjens@hotmail.com>
* Add oAuthEndpoint to _oAuthClients cache key * Add CreateOAuthClientWithDifferentEndpoints test Co-authored-by: Craig Jensen <crjens@hotmail.com> Co-authored-by: craigjensen <cjensen@microsoft.com> Co-authored-by: Craig Jensen <crjens@hotmail.com>
* Add oAuthEndpoint to _oAuthClients cache key * Add CreateOAuthClientWithDifferentEndpoints test Co-authored-by: Craig Jensen <crjens@hotmail.com>
* Add oAuthEndpoint to _oAuthClients cache key * Add CreateOAuthClientWithDifferentEndpoints test Co-authored-by: Craig Jensen <crjens@hotmail.com> Co-authored-by: craigjensen <cjensen@microsoft.com> Co-authored-by: Craig Jensen <crjens@hotmail.com>
Fixes #6308
Description
We cache OAuthClients by appId so changing the endpoint only affects newly created clients that are not already cached. This PR adds the endpoint to the cache key so we can support changing the endpoint at runtime.
Specific Changes
Testing
Added tests for