@@ -421,31 +421,6 @@ def _authenticate_plain(credentials, sock_info):
421
421
sock_info .command (source , cmd )
422
422
423
423
424
- def _authenticate_cram_md5 (credentials , sock_info ):
425
- """Authenticate using CRAM-MD5 (RFC 2195)
426
- """
427
- source = credentials .source
428
- username = credentials .username
429
- password = credentials .password
430
- # The password used as the mac key is the
431
- # same as what we use for MONGODB-CR
432
- passwd = _password_digest (username , password )
433
- cmd = SON ([('saslStart' , 1 ),
434
- ('mechanism' , 'CRAM-MD5' ),
435
- ('payload' , Binary (b'' )),
436
- ('autoAuthorize' , 1 )])
437
- response = sock_info .command (source , cmd )
438
- # MD5 as implicit default digest for digestmod is deprecated
439
- # in python 3.4
440
- mac = hmac .HMAC (key = passwd .encode ('utf-8' ), digestmod = hashlib .md5 )
441
- mac .update (response ['payload' ])
442
- challenge = username .encode ('utf-8' ) + b' ' + mac .hexdigest ().encode ('utf-8' )
443
- cmd = SON ([('saslContinue' , 1 ),
444
- ('conversationId' , response ['conversationId' ]),
445
- ('payload' , Binary (challenge ))])
446
- sock_info .command (source , cmd )
447
-
448
-
449
424
def _authenticate_x509 (credentials , sock_info ):
450
425
"""Authenticate using MONGODB-X509.
451
426
"""
@@ -497,7 +472,6 @@ def _authenticate_default(credentials, sock_info):
497
472
498
473
499
474
_AUTH_MAP = {
500
- 'CRAM-MD5' : _authenticate_cram_md5 ,
501
475
'GSSAPI' : _authenticate_gssapi ,
502
476
'MONGODB-CR' : _authenticate_mongo_cr ,
503
477
'MONGODB-X509' : _authenticate_x509 ,
0 commit comments