The :py:class:`~django_ca.extensions.AuthorityKeyIdentifier` extension, or ``None`` if it doesn't
        exist.
351971
def authority_key_identifier(self):
        """"""
        try:
            ext = self.x509.extensions.get_extension_for_oid(ExtensionOID.AUTHORITY_KEY_IDENTIFIER)
        except x509.ExtensionNotFound:
            return None
        return AuthorityKeyIdentifier(ext)
768182
def handle_authn_response(self, context, internal_response):
        
        return self._handle_authn_response(context, internal_response, self.idp)
1085665
def _possible_issuers(self, cert):
        

        issuer_hashable = cert.issuer.hashable
        if issuer_hashable not in self._subject_map:
            return

        for issuer in self._subject_map[issuer_hashable]:
            # Info from the authority key identifier extension can be used to
            # eliminate possible options when multiple keys with the same
            # subject exist, such as during a transition, or with cross-signing.
            if cert.authority_key_identifier and issuer.key_identifier:
                if cert.authority_key_identifier != issuer.key_identifier:
                    continue
            elif cert.authority_issuer_serial:
                if cert.authority_issuer_serial != issuer.issuer_serial:
                    continue

            yield issuer
163031
def api_key(request, response, verify_user, context=None, **kwargs):
    
    api_key = request.get_header('X-Api-Key')

    if api_key:
        try:
            user = verify_user(api_key)
        except TypeError:
            user = verify_user(api_key, context)
        if user:
            return user
        else:
            return False
    else:
        return None
636342
def by_type(self, identifier_class):
        
        myidentifiers = set()
        for identifier in self.source_identifiers.values():
            if (isinstance(identifier, identifier_class)):
                myidentifiers.update([identifier])
        return set(myidentifiers)
1050435
def _get_pk_from_identity(obj):
        """"""
        from sqlalchemy.orm.util import identity_key

        cls, key = identity_key(instance=obj)[0:2]
        return ":".join(text_type(x) for x in key)
1187881
def authenticate_identify(self, api_token, override=True):
        
        if (self.context.has_auth_params('Gem-Identify') and not override):
            raise OverrideError('Gem-Identify')

        if (not api_token or
            not self.context.authorize('Gem-Identify', api_token=api_token)):
            raise AuthUsageError(self.context, 'Gem-Identify')

        return True
873429
def _newIdentifier(self):
        
        id = self._allocateID()
        self._idsToObjects[id] = self._NO_OBJECT_MARKER
        self._lastValues[id] = None
        return id
111108
def anonymous(self):
        
        if hasattr(self.handler, 'anonymous'):
            anon = self.handler.anonymous

            if callable(anon):
                return anon

            for klass in typemapper.keys():
                if anon == klass.__name__:
                    return klass

        return None
1318327
def disco_response(self, context):
        
        info = context.request
        state = context.state

        try:
            entity_id = info["entityID"]
        except KeyError as err:
            satosa_logging(logger, logging.DEBUG, "No IDP chosen for state", state, exc_info=True)
            raise SATOSAAuthenticationError(state, "No IDP chosen") from err

        return self.authn_request(context, entity_id)
1095501
def identify(self, req, resp, resource, uri_kwargs):
        """"""
        try:
            return req.get_header('X-Api-Key', True)
        except (KeyError, HTTPMissingHeader):
            pass
1362011
def identify(self, req, resp, resource, uri_kwargs):
        """"""
        header = req.get_header('Authorization', False)
        auth = header.split(' ') if header else None

        if auth is None or auth[0].lower() != 'token':
            return None

        if len(auth) != 2:
            raise HTTPBadRequest(
                "Invalid Authorization header",
                "The Authorization header for Token auth should be in form:\n"
                "Authorization: Token <token_value>"
            )

        return auth[1]
762131
def get(self, sid):
        
        return SigningKeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, )
1155599
def get_from_human_key(self, key):
        """"""
        if key in self._identifier_map:
            return self._identifier_map[key]
        raise KeyError(key)
447985
def valid_id(opts, id_):
    '''
    
    '''
    try:
        if any(x in id_ for x in ('/', '\\', str('\0'))):
            return False
        return bool(clean_path(opts['pki_dir'], id_))
    except (AttributeError, KeyError, TypeError, UnicodeDecodeError):
        return False
965670
def defaultDecoder(self, message, server):
        
        mode = message.getArg(OPENID_NS, 'mode')
        fmt = "Unrecognized OpenID mode %r"
        raise ProtocolError(message, text=fmt % (mode,))
480585
def _win_user_token_is_admin(user_token):
    '''
    
    '''
    class SID_IDENTIFIER_AUTHORITY(ctypes.Structure):
        _fields_ = [
            ("byte0", ctypes.c_byte),
            ("byte1", ctypes.c_byte),
            ("byte2", ctypes.c_byte),
            ("byte3", ctypes.c_byte),
            ("byte4", ctypes.c_byte),
            ("byte5", ctypes.c_byte),
        ]
    nt_authority = SID_IDENTIFIER_AUTHORITY()
    nt_authority.byte5 = 5

    SECURITY_BUILTIN_DOMAIN_RID = 0x20
    DOMAIN_ALIAS_RID_ADMINS = 0x220
    administrators_group = ctypes.c_void_p()
    if ctypes.windll.advapi32.AllocateAndInitializeSid(
            ctypes.byref(nt_authority),
            2,
            SECURITY_BUILTIN_DOMAIN_RID,
            DOMAIN_ALIAS_RID_ADMINS,
            0, 0, 0, 0, 0, 0,
            ctypes.byref(administrators_group)) == 0:
        raise Exception("AllocateAndInitializeSid failed")

    try:
        is_admin = ctypes.wintypes.BOOL()
        if ctypes.windll.advapi32.CheckTokenMembership(
                user_token,
                administrators_group,
                ctypes.byref(is_admin)) == 0:
            raise Exception("CheckTokenMembership failed")
        return is_admin.value != 0

    finally:
        ctypes.windll.advapi32.FreeSid(administrators_group)