
    &g                        S r SSKJr  SSKJrJrJrJr  SSKrSSK	J
r
  SSKJrJr  \(       a  SSKJr  SSKJr  SS	KJr  S
rSS jrg)z#MONGODB-AWS Authentication helpers.    )annotations)TYPE_CHECKINGAnyMappingTypeNBinary)ConfigurationErrorOperationFailure)_ReadableBuffer)AsyncConnection)MongoCredentialFc                
  #     SSK nSSKJnJn  U" S5        UR                  S:  a  [        S5      e " S S	UR                  5      n U" UR                  U R                  U R                  U R                  R                  5      5      nUR                  S5      nS
SUS.n	UR                  SU	5      I Sh  vN n
U
n[        S5       HF  nUR                  US   5      nS
U
S   US.nUR                  SU5      I Sh  vN nUS   (       d  MF    g   g! [         a  n[        S5      UeSnAff = f Nz N5! UR                    a)  nU" S5        [#        U SUR$                   S35      SeSnAf[&         a
    U" S5        e f = f7f)zAuthenticate using MONGODB-AWS.r   NzhMONGODB-AWS authentication requires pymongo-auth-aws: install with: python -m pip install 'pymongo[aws]')set_cached_credentialsset_use_cached_credentialsT	   z@MONGODB-AWS authentication requires MongoDB version 4.4 or laterc                  2    \ rS rSrSS jrSS jrS	S jrSrg)
)_authenticate_aws.<locals>.AwsSaslContext4   c                    [         $ )z#Return the bson.binary.Binary type.r   )selfs    bC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\pymongo/asynchronous/auth_aws.pybinary_type5_authenticate_aws.<locals>.AwsSaslContext.binary_type6   s    M    c                .    [         R                  " U5      $ )zEncode a dictionary to BSON.)bsonencode)r   docs     r   bson_encode5_authenticate_aws.<locals>.AwsSaslContext.bson_encode:   s    ;;s##r   c                .    [         R                  " U5      $ )zDecode BSON to a dictionary.)r   decode)r   datas     r   bson_decode5_authenticate_aws.<locals>.AwsSaslContext.bson_decode>   s    ;;t$$r    N)returnzType[Binary])r   Mapping[str, Any]r(   bytes)r$   r   r(   r)   )__name__
__module____qualname____firstlineno__r   r    r%   __static_attributes__r'   r   r   AwsSaslContextr   4   s    		$	%r   r0      zMONGODB-AWS)	saslStart	mechanismpayloadz	$external
   r4   conversationId)saslContinuer6   r4   donez (pymongo-auth-aws version ))pymongo_auth_awsImportErrorr
   pymongo_auth_aws.authr   r   max_wire_versionr0   AwsCredentialusernamepasswordmechanism_propertiesaws_session_tokenstepcommandrangePyMongoAuthAwsErrorr   __version__	Exception)credentialsconnr:   er   r   r0   ctxclient_payloadclient_firstserver_firstres_cmdexcs                  r   _authenticate_awsrT       s    
 t$q  !cdd%)88 %"**$$$$00BB
 $%&]~^!\\+|DDrA XXc)n5N !"./?"@)C
 [#66C6{{ W   A
 	P E 7 // t$e./?/K/K.LAN
	  t$s   FD A F	A-D5 6D17AD5 =D3>D5 D5 FD5 F
D.D))D..F1D5 3D5 5F $E))F  F)rI   r   rJ   r   r(   None)__doc__
__future__r   typingr   r   r   r   r   bson.binaryr	   pymongo.errorsr
   r   bson.typingsr   pymongo.asynchronous.poolr   pymongo.auth_sharedr   _IS_SYNCrT   r'   r   r   <module>r_      s3    * " 4 4   ?,93Dr   