Add oAuthEndpoint to _oAuthClients cache key - #6298
Conversation
Pull Request Test Coverage Report for Build 301650
💛 - Coveralls |
| OAuthClientConfig.EmulateOAuthCards = true; | ||
| } | ||
|
|
||
| var oAuthEndpoint = OAuthClientConfig.OAuthEndpoint; |
There was a problem hiding this comment.
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.
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