MCPcopy Index your code
hub / github.com/python/cpython / authenticate

Method authenticate

Lib/imaplib.py:501–527  ·  view source on GitHub ↗

Authenticate command - requires response processing. 'mechanism' specifies which authentication mechanism is to be used - it must appear in .capabilities in the form AUTH= . 'authobject' must be a callable object: data = authobje

(self, mechanism, authobject)

Source from the content-addressed store, hash-verified

499
500
501 def authenticate(self, mechanism, authobject):
502 """Authenticate command - requires response processing.
503
504 'mechanism' specifies which authentication mechanism is to
505 be used - it must appear in <instance>.capabilities in the
506 form AUTH=<mechanism>.
507
508 'authobject' must be a callable object:
509
510 data = authobject(response)
511
512 It will be called to process server continuation responses; the
513 response argument it is passed will be a bytes. It should return bytes
514 data that will be base64 encoded and sent to the server. It should
515 return None if the client abort response '*' should be sent instead.
516 """
517 mech = mechanism.upper()
518 # XXX: shouldn't this code be removed, not commented out?
519 #cap = 'AUTH=%s' % mech
520 #if not cap in self.capabilities: # Let the server decide!
521 # raise self.error("Server doesn't allow %s authentication." % mech)
522 self.literal = _Authenticator(authobject).process
523 typ, dat = self._simple_command('AUTHENTICATE', mech)
524 if typ != 'OK':
525 raise self.error(dat[-1].decode('utf-8', 'replace'))
526 self.state = 'AUTH'
527 return typ, dat
528
529
530 def capability(self):

Calls 5

_simple_commandMethod · 0.95
_AuthenticatorClass · 0.85
upperMethod · 0.45
errorMethod · 0.45
decodeMethod · 0.45