o Sûbh ã@sœdZzddlZddlmZmZmZdZWney'Gdd„deƒZdZYnwddlZddl m Z dd l m Z dd l mZmZGd d „d eƒZd d„ZdS)z#MONGODB-AWS Authentication helpers.éN)Ú AwsCredentialÚAwsSaslContextÚPyMongoAuthAwsErrorTc@seZdZdd„ZdS)rcCsdS)N©)ÚselfÚ credentialsrrú7/tmp/pip-target-onvjaxws/lib/python/pymongo/auth_aws.pyÚ__init__szAwsSaslContext.__init__N)Ú__name__Ú __module__Ú __qualname__r rrrrrs rF©ÚBinary)ÚSON)ÚConfigurationErrorÚOperationFailurec@s$eZdZdd„Zdd„Zdd„ZdS)Ú_AwsSaslContextcCstS)z#Return the bson.binary.Binary type.r )rrrrÚ binary_type&sz_AwsSaslContext.binary_typecCó t |¡S)zEncode a dictionary to BSON.)ÚbsonÚencode)rÚdocrrrÚ bson_encode*ó z_AwsSaslContext.bson_encodecCr)zDecode BSON to a dictionary.)rÚdecode)rÚdatarrrÚ bson_decode.rz_AwsSaslContext.bson_decodeN)r r r rrrrrrrr$s rc Csætstdƒ‚|jdkrtdƒ‚zNtt|j|j|jjƒƒ}|  d¡}t ddd|fgƒ}|  d|¡}|}t d ƒD]$}|  |d¡}t d d |d fd|fgƒ}|  d|¡}|d rZWdSq6WdSt yr} z td | tjfƒ‚d} ~ ww)zAuthenticate using MONGODB-AWS.zhMONGODB-AWS authentication requires pymongo-auth-aws: install with: python -m pip install 'pymongo[aws]'é z@MONGODB-AWS authentication requires MongoDB version 4.4 or laterN)Z saslStarté)Z mechanismz MONGODB-AWSÚpayloadz $externalé )Z saslContinuerZconversationIdÚdonez %s (pymongo-auth-aws version %s))Ú_HAVE_MONGODB_AWSrZmax_wire_versionrrÚusernameÚpasswordZmechanism_propertiesZaws_session_tokenÚsteprÚcommandÚrangerrÚpymongo_auth_awsÚ __version__) rZ sock_infoÚctxZclient_payloadZ client_firstZ server_firstÚresÚ_ÚcmdÚexcrrrÚ_authenticate_aws3sNÿ ýÿ  ÿ   ýÿ þö  ÿ€þr/)Ú__doc__r(rrrr"Ú ImportErrorÚobjectrZ bson.binaryrZbson.sonrZpymongo.errorsrrrr/rrrrÚs ú