fix: some races when accessing ldap/openid config globally (#14978)

This commit is contained in:
Harshavardhana
2022-05-25 18:32:53 -07:00
committed by GitHub
parent 5aae7178ad
commit fd46a1c3b3
6 changed files with 83 additions and 11 deletions

View File

@@ -359,4 +359,18 @@ var (
// Add new variable global values here.
)
var globalAuthZPluginMutex sync.Mutex
func newGlobalAuthZPluginFn() *polplugin.AuthZPlugin {
globalAuthZPluginMutex.Lock()
defer globalAuthZPluginMutex.Unlock()
return globalAuthZPlugin
}
func setGlobalAuthZPlugin(authz *polplugin.AuthZPlugin) {
globalAuthZPluginMutex.Lock()
globalAuthZPlugin = authz
globalAuthZPluginMutex.Unlock()
}
var errSelfTestFailure = errors.New("self test failed. unsafe to start server")