
    jw
                         d dl Z d dlZd dlmZmZmZ d dl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	Z G d
 de      Zdedee   fdZdedededefdZy)    N)DictOptionalAny)AccessTokenAccessTokenInfoTokenRequestOptions)ClientAuthenticationError)HttpRequest   )EnvironmentVariables)MsalManagedIdentityClienta  Specifying a client_id or identity_config is not supported by the Service Fabric managed identity environment. The managed identity configuration is determined by the Service Fabric cluster resource configuration. See https://aka.ms/servicefabricmi for more information.c                   ~     e Zd ZddedefdZddddedee   dee   d	edef
 fd
Zdddedee	   de
f fdZ xZS )ServiceFabricCredentialdescreturnc                     d| S )NzHService Fabric managed identity configuration not found in environment.  )selfr   s     k/root/aria/tools/markitdown-venv/lib/python3.12/site-packages/azure/identity/_credentials/service_fabric.pyget_unavailable_messagez/ServiceFabricCredential.get_unavailable_message   s    YZ^Y_``    Nclaims	tenant_idscopesr   r   kwargsc                    | j                   j                  d      s| j                   j                  d      rt        t              t	        |   |||d|S )N	client_ididentity_configmessager   )	_settingsgetr	   SERVICE_FABRIC_ERROR_MESSAGEsuper	get_token)r   r   r   r   r   	__class__s        r   r&   z!ServiceFabricCredential.get_token   sO     >>k*dnn.@.@AR.S+4PQQw &9WPVWWr   )optionsr(   c                    | j                   j                  d      s| j                   j                  d      rt        t              t	        |   |d|iS )Nr   r   r    r(   )r"   r#   r	   r$   r%   get_token_info)r   r(   r   r'   s      r   r*   z&ServiceFabricCredential.get_token_info#   sH    >>k*dnn.@.@AR.S+4PQQw%v?w??r   ) )__name__
__module____qualname__strr   r   r   r   r&   r   r   r*   __classcell__)r'   s   @r   r   r      s    aC a a 59UYXX$,SMXEMc]XehX	X UY @c @H=P4Q @]l @ @r   r   r   r   c            	      p   t         j                  j                  t        j                        }t         j                  j                  t        j
                        }t         j                  j                  t        j                        }|r|r|sy t        | d|idt        j                  t        |            S )NSecretF)base_headersconnection_verifyrequest_factory)osenvironr#   r   IDENTITY_ENDPOINTIDENTITY_HEADERIDENTITY_SERVER_THUMBPRINTdict	functoolspartial_get_request)r   urlsecret
thumbprints       r   _get_client_argsrB   )   s    
**..-??
@CZZ^^0@@AF 4 O OPJFz'!)),<	 r   r?   scoper   c           	      8    t        d| t        d|dfi |      S )NGETz2019-07-01-preview)zapi-versionresource)params)r
   r;   )r?   rC   r   s      r   r>   r>   9   s(    s40DRW Xl\kl r   )r<   r6   typingr   r   r   azure.core.credentialsr   r   r   azure.core.exceptionsr	   azure.core.restr
   
_constantsr   &_internal.msal_managed_identity_clientr   r$   r   rB   r/   r>   r   r   r   <module>rN      sv   
  	 & & T T ; ' - N? @7 @"s x~  c #   r   