def test_activate_builtin_random_already_active(self): backend.activate_builtin_random() e = backend._lib.ENGINE_get_default_RAND() assert e == backend._ffi.NULL backend.activate_builtin_random() e = backend._lib.ENGINE_get_default_RAND() assert e == backend._ffi.NULL
def test_activate_builtin_random(self): e = backend._lib.ENGINE_get_default_RAND() assert e != backend._ffi.NULL name = backend._lib.ENGINE_get_name(e) assert name == backend._binding._osrandom_engine_name res = backend._lib.ENGINE_free(e) assert res == 1 backend.activate_builtin_random() e = backend._lib.ENGINE_get_default_RAND() assert e == backend._ffi.NULL
def test_activate_osrandom_no_default(self): backend.activate_builtin_random() e = backend._lib.ENGINE_get_default_RAND() assert e == backend._ffi.NULL backend.activate_osrandom_engine() e = backend._lib.ENGINE_get_default_RAND() name = backend._lib.ENGINE_get_name(e) assert name == backend._lib.Cryptography_osrandom_engine_name res = backend._lib.ENGINE_free(e) assert res == 1
from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import Group from django.core.exceptions import ImproperlyConfigured, PermissionDenied, ObjectDoesNotExist from requests import post from .config import settings logger = logging.getLogger(__name__) # MUST come before any HTTPS request. # If not, the python process deadlocks and generates gateway timeouts # -> Timeout when reading response headers from daemon process # -> function Cryptography_rand_bytes() called, but no code was attached to # it yet with @ffi.def_extern() # REF: https://github.com/pyca/cryptography/issues/2299#issuecomment-182835098 backend.activate_builtin_random() class AdfsBackend(ModelBackend): """ Authentication backend to allow authenticating users against a Microsoft ADFS server. It's based on the ``RemoteUserBackend`` from Django. """ # Globally cache keys because Django instantiates our class on every # authentication. Loading keys every time would waste resources. _public_keys = [] _key_age = None def __init__(self): if not settings.SIGNING_CERT:
def get_soup(url): backend.activate_builtin_random() # https://github.com/pyca/cryptography/issues/2299#issuecomment-135518559 page = requests.get(url) soup = bs(page.text, 'html.parser') #TODO https://stackoverflow.com/questions/21006940/how-to-load-all-entries-in-an-infinite-scroll-at-once-to-parse-the-html-in-pytho return soup
def test_activate_builtin_random_does_nothing(self): backend.activate_builtin_random()