o
    ¾­§iÖ  ã                   @   s|   d dl Z d dlmZmZmZmZ d dlmZ d dlm	Z	 d dl
mZ ddlmZ ddlmZ dd	lmZ G d
d„ deƒZdS )é    N)ÚIterableÚUnionÚOptionalÚAny)ÚAccessTokenInfo)ÚPipeline)ÚHttpRequesté   )ÚAadClientBase)ÚAadClientCertificate©Úbuild_pipelinec                   @   s   e Zd Zd%dd„Zdd„ Zd&dd„Z	d'd	ee d
ededee de	de
fdd„Zd	ee dede	de
fdd„Zd	ee dede	de
fdd„Zd	ee dede	de
fdd„Zd	ee dede	de
fdd„Zd	ee deeef dede	de
f
dd„Zde	defd d!„Zd"ede	de
fd#d$„ZdS )(Ú	AadClientÚreturnc                 C   s   | j  ¡  | S ©N)Ú	_pipelineÚ	__enter__©Úself© r   úZ/home/app/Keep/.python/lib/python3.10/site-packages/azure/identity/_internal/aad_client.pyr      s   
zAadClient.__enter__c                 G   s   | j j|Ž  d S r   )r   Ú__exit__)r   Úargsr   r   r   r      s   zAadClient.__exit__Nc                 C   s   |   ¡  d S r   )r   r   r   r   r   Úclose   s   zAadClient.closeÚscopesÚcodeÚredirect_uriÚclient_secretÚkwargsc                 K   s,   | j d||||dœ|¤Ž}| j|fi |¤ŽS )N)r   r   r   r   r   )Z_get_auth_code_requestÚ_run_pipeline)r   r   r   r   r   r   Úrequestr   r   r   Ú"obtain_token_by_authorization_code   s   ÿÿz,AadClient.obtain_token_by_authorization_codeÚcertificatec                 K   ó&   | j ||fi |¤Ž}| j|fi |¤ŽS r   )Z_get_client_certificate_requestr   )r   r   r"   r   r    r   r   r   Ú"obtain_token_by_client_certificate$   ó   z,AadClient.obtain_token_by_client_certificateÚsecretc                 K   r#   r   )Z_get_client_secret_requestr   )r   r   r&   r   r    r   r   r   Úobtain_token_by_client_secret*   ó   z'AadClient.obtain_token_by_client_secretÚ	assertionc                 K   r#   r   )Z_get_jwt_assertion_requestr   )r   r   r)   r   r    r   r   r   Úobtain_token_by_jwt_assertion.   r(   z'AadClient.obtain_token_by_jwt_assertionÚrefresh_tokenc                 K   r#   r   )Z_get_refresh_token_requestr   )r   r   r+   r   r    r   r   r   Úobtain_token_by_refresh_token2   r%   z'AadClient.obtain_token_by_refresh_tokenÚclient_credentialÚuser_assertionc                 K   s   t ƒ ‚r   )ÚNotImplementedError)r   r   r-   r.   r   r   r   r   Úobtain_token_on_behalf_of8   s   z#AadClient.obtain_token_on_behalf_ofc                 K   s   t di |¤ŽS )Nr   r   )r   r   r   r   r   Ú_build_pipelineB   s   zAadClient._build_pipeliner    c                 K   sn   |  dd ¡ |  dd ¡ |  dd ¡ |  dd¡}tt ¡ ƒ}| jj|fd| ji|¤Ž}| j||fd|i|¤ŽS )NZ	tenant_idZclaimsr   Ú
enable_caeFZretry_on_methods)ÚpopÚintÚtimer   ÚrunZ_POSTZ_process_response)r   r    r   r2   ÚnowÚresponser   r   r   r   E   s   zAadClient._run_pipeline)r   r   )r   Nr   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   Ústrr   r   r   r!   r   r$   r'   r*   r,   r   r0   r   r1   r   r   r   r   r   r   r      sf    

ÿÿÿÿÿÿ
þÿÿÿ
þÿÿÿ
þþ
ýüû
ú
r   )r5   Útypingr   r   r   r   Zazure.core.credentialsr   Zazure.core.pipeliner   Zazure.core.restr   Zaad_client_baser
   Zaadclient_certificater   Zpipeliner   r   r   r   r   r   Ú<module>   s   