Return the authentication based on it's id.
170066
def _get_authentication_from_public_key_id(self, key_id):
        """"""
        for authentication in self._authentications:
            if authentication.is_key_id(key_id):
                return authentication
        return None
624701
def get_user_id(self, provider, info):
        ""
        id_key = self.provider_id or 'id'
        result = info
        try:
            for key in id_key.split('.'):
                result = result[key]
            return result
        except KeyError:
            return None
1375058
def get_id(self):
        
        if self._id is None:
            self._id = graceful_get(self.inspect(refresh=True), "ID")
        return self._id
1315183
def authenticate(self):
        """"""
        if self.apiKey:
            return
        loginResponse = self._curl_bitmex(
            api="user/login",
            postdict={'email': self.login, 'password': self.password, 'token': self.otpToken})
        self.token = loginResponse['id']
        self.session.headers.update({'access-token': self.token})
1155541
def user_id(self):
        
        if self._user_id is None:
            if self.has_logged_in:
                self._user_id = self._req_get_user_aq()['data']['uid']
            else:
                raise AuthenticationError('Not logged in.')
        return self._user_id
1352901
def by_id(self, id):
        """"""
        path = partial(_path, self.adapter)
        path = path(id)
        return self._get(path)
541755
async def login(self, request, id_):
        """"""
        session = await self.load(request)
        session['id'] = id_
908822
def authenticationResponse():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x14)  # 00010100
    c = AuthenticationParameterSRES()
    packet = a / b / c
    return packet
135981
def id(self):
        """"""
        id = ''
        if (self.server_and_prefix is not None and
                self.server_and_prefix != ''):
            id += self.server_and_prefix + '/'
        if (self.identifier is not None):
            id += self.identifier
        return id
208975
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() != 'basic':
            return None

        if len(auth) != 2:
            raise HTTPBadRequest(
                "Invalid Authorization header",
                "The Authorization header for Basic auth should be in form:\n"
                "Authorization: Basic <base64-user-pass>"
            )

        user_pass = auth[1]

        try:
            decoded = base64.b64decode(user_pass).decode()

        except (TypeError, UnicodeDecodeError, binascii.Error):
            raise HTTPBadRequest(
                "Invalid Authorization header",
                "Credentials for Basic auth not correctly base64 encoded."
            )

        username, _, password = decoded.partition(":")
        return username, password
414812
def authenticate(self, request, **kwargs):
        """"""

        self.request = request
        if not self.request:
            return None

        state = self.request.GET.get('state')
        code = self.request.GET.get('code')
        nonce = kwargs.pop('nonce', None)

        if not code or not state:
            return None

        reverse_url = self.get_settings('OIDC_AUTHENTICATION_CALLBACK_URL',
                                        'oidc_authentication_callback')

        token_payload = {
            'client_id': self.OIDC_RP_CLIENT_ID,
            'client_secret': self.OIDC_RP_CLIENT_SECRET,
            'grant_type': 'authorization_code',
            'code': code,
            'redirect_uri': absolutify(
                self.request,
                reverse(reverse_url)
            ),
        }

        # Get the token
        token_info = self.get_token(token_payload)
        id_token = token_info.get('id_token')
        access_token = token_info.get('access_token')

        # Validate the token
        payload = self.verify_token(id_token, nonce=nonce)

        if payload:
            self.store_tokens(access_token, id_token)
            try:
                return self.get_or_create_user(access_token, id_token, payload)
            except SuspiciousOperation as exc:
                LOGGER.warning('failed to get or create user: %s', exc)
                return None

        return None
578098
def verify(self, id):
        
        url = self._url('%s/verify' % (id))
        return self.client.post(url)
172043
def authenticate(self):
        """"""
        try:
            payload = self._api.domain.info(self._api_key, self._domain)
            self._zone_id = payload['zone_id']
            return payload['id']
        except xmlrpclib.Fault as err:
            raise Exception("Failed to authenticate: '{0}'".format(err))
985258
def authenticate(api_key, api_url, **kwargs):
    """"""

    muddle = Muddle(**kwargs)

    # Login.
    muddle.authenticate(api_key, api_url)
    return muddle
779089
def get_public_key(self, key_id, is_search_embedded=False):
        """"""
        if isinstance(key_id, int):
            return self._public_keys[key_id]

        for item in self._public_keys:
            if item.get_id() == key_id:
                return item

        if is_search_embedded:
            for authentication in self._authentications:
                if authentication.get_public_key_id() == key_id:
                    return authentication.get_public_key()
        return None
873498
def get_request(self, request):
        """"""
        request.headers['authenticate'] = {
            'username': self.username,
            'apiKey': self.api_key,
        }
        return request
1140860
def get(self, id):
        
        url = self._url('%s' % (id))
        return self.client.get(url)