mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Initialize xmlsec once to prevent SAML auth from hanging.
This commit is contained in:
parent
fd26cf6176
commit
ff9945037f
@ -1,2 +1,21 @@
|
|||||||
# Copyright (c) 2015 Ansible, Inc.
|
# Copyright (c) 2015 Ansible, Inc.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
# Python
|
||||||
|
import threading
|
||||||
|
|
||||||
|
# Monkeypatch xmlsec.initialize() to only run once (https://github.com/ansible/ansible-tower/issues/3241).
|
||||||
|
xmlsec_init_lock = threading.Lock()
|
||||||
|
xmlsec_initialized = False
|
||||||
|
|
||||||
|
import dm.xmlsec.binding
|
||||||
|
original_xmlsec_initialize = dm.xmlsec.binding.initialize
|
||||||
|
|
||||||
|
def xmlsec_initialize(*args, **kwargs):
|
||||||
|
global xmlsec_init_lock, xmlsec_initialized, original_xmlsec_initialize
|
||||||
|
with xmlsec_init_lock:
|
||||||
|
if not xmlsec_initialized:
|
||||||
|
original_xmlsec_initialize(*args, **kwargs)
|
||||||
|
xmlsec_initialized = True
|
||||||
|
|
||||||
|
dm.xmlsec.binding.initialize = xmlsec_initialize
|
||||||
|
Loading…
Reference in New Issue
Block a user