Get an auth key to use for authentication.
179059
def _auth_key(nonce, username, password):
    
    digest = _password_digest(username, password)
    md5hash = hashlib.md5()
    md5hash.update("%s%s%s" % (nonce, unicode(username), digest))
    return unicode(md5hash.hexdigest())
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})
182437
def get_authorization_url(self):
        """"""
        url = self._get_oauth_url('authenticate')
        query = {
            'client_id': self._client_id,
            'response_type': 'code',
            'redirect_uri': self.callback
        }
        query_str = self.urlencode(query)

        return url + '?' + query_str
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
1369452
def _auth_key(nonce, username, password):
    
    digest = _password_digest(username, password)
    md5hash = hashlib.md5()
    data = "%s%s%s" % (nonce, username, digest)
    md5hash.update(data.encode('utf-8'))
    return _unicode(md5hash.hexdigest())
1367709
def auth_token(self, apikey=None, secret=None, email=None, password=None):
        
        if (apikey and secret) or (self._apikey and self._secret):
            body = {
                "key_id": apikey or self._apikey,
                "secret": secret or self._secret
            }
        elif (email and password) or (self._email and self._password):
            body = {
                "user" : email or self._email,
                "password" : password or self._password
            }
        else:
            raise Value("No authentication provided.")
        response = self._post(url.auth, body=body)

        self._check_response(response, 200)
        return self._create_response(response).get("jwt")
1156492
def _get_pkey(self):
        """"""
        keypath = self.config.server["pkey"]
        with open(os.path.expanduser(keypath)) as f:
            pkey = paramiko.RSAKey.from_private_key(f)

        return pkey
220959
def construct_auth (self):
        """"""
        if self.auth:
            return
        _user, _password = self.get_user_password()
        if _user is not None and _password is not None:
            self.auth = (_user, _password)
818834
def authenticate(self, request, **credentials):
        """"""
        from allauth.account.auth_backends import AuthenticationBackend

        self.pre_authenticate(request, **credentials)
        AuthenticationBackend.unstash_authenticated_user()
        user = authenticate(request, **credentials)
        alt_user = AuthenticationBackend.unstash_authenticated_user()
        user = user or alt_user
        if user and app_settings.LOGIN_ATTEMPTS_LIMIT:
            cache_key = self._get_login_attempts_cache_key(
                request, **credentials)
            cache.delete(cache_key)
        else:
            self.authentication_failed(request, **credentials)
        return user
1303981
def client_auth(self):
        """"""
        if not self._client_auth:
            self._client_auth = E.Element('merchantAuthentication')
            E.SubElement(self._client_auth, 'name').text = self.config.login_id
            E.SubElement(self._client_auth, 'transactionKey').text = self.config.transaction_key
        return self._client_auth
1356698
def __get_auth(self):
        ''''''
        if self.api_key == None and self.login == None:
            self.logger.error("No authentication provided! Unable to connect.")
            sys.exit(1)

        if self.api_key == None:
            self.logger.info("Authenticating with email/password.")
            return [
                "email: " + self.login,
                "password: " + self.password
            ]
        else:
            self.logger.info("Authenticating with API Key.")
            # To auth to the WS using an API key, we generate a signature of a nonce and
            # the WS API endpoint.
            nonce = generate_nonce()
            return [
                "api-nonce: " + str(nonce),
                "api-signature: " + generate_signature(self.api_secret, 'GET', '/realtime', nonce, ''),
                "api-key:" + self.api_key
            ]
151306
def sha(self):
        """"""
        if self._sha is None:
            self._sha = compute_auth_key(self.userid, self.password)
        return self._sha
1244198
def _auth(url, user, passwd, realm):
    '''
    
    '''

    basic = _HTTPBasicAuthHandler()
    basic.add_password(realm=realm, uri=url, user=user, passwd=passwd)
    digest = _HTTPDigestAuthHandler()
    digest.add_password(realm=realm, uri=url, user=user, passwd=passwd)
    return _build_opener(basic, digest)
882293
def auth(self):
        
        return self.values.get(Config.AUTH, os.environ.get(AUTH_ENV_KEY_NAME, None))
4391
def authentication(self):
        """"""
        if self.session.digest:
            authentication = self.session.generate_digest()
        elif self.session.basic:
            authentication = self.session.generate_basic()
        else:
            return ''
        return "Authorization: " + authentication + '\r\n'
1156263
def get_public_key(self):
        """"""
        return PublicKey.from_verifying_key(
            self._private_key.get_verifying_key(),
            network=self.network, compressed=self.compressed)
1076931
def _auth(self):
        
        ts = datetime.datetime.now().strftime("%Y-%m-%d%H:%M:%S")
        hash_string = hashlib.md5("%s%s%s" % (ts, self.private_key, self.public_key)).hexdigest()
        return "ts=%s&apikey=%s&hash=%s" % (ts, self.public_key, hash_string)