def _login(userHandle, passwd, nexusServer, cached=0, authData=''):
"""
This function is used internally and should not ever be called
directly.
"""
cb = Deferred()
def _cb(server, auth):
loginFac = ClientFactory()
loginFac.protocol = lambda : PassportLogin(cb, userHandle, passwd, server, auth)
reactor.connectSSL(_parsePrimitiveHost(server)[0], 443, loginFac, ClientContextFactory())
if cached:
_cb(nexusServer, authData)
else:
fac = ClientFactory()
d = Deferred()
d.addCallbacks(_cb, callbackArgs=(authData,))
d.addErrback(lambda f: cb.errback(f))
fac.protocol = lambda : PassportNexus(d, nexusServer)
reactor.connectSSL(_parsePrimitiveHost(nexusServer)[0], 443, fac, ClientContextFactory())
return cb
评论列表
文章目录