
    io                     Z    d dl Z d dlZddZd Zdej        fdZ ej        e           dS )    NFc                     |                      d          pd}|                                }|dk    rt          |           S t          d|           )zH
    Generates an Azure access token based on provided credentials.
    	auth_type azureserviceprincipalz.Unrecognized auth_type authentication method: )getlower_service_principal_credentials
ValueError)token_auth_configrefreshuser_auth_typer   s       m/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/oracledb/plugins/azure_tokens.pygenerate_tokenr   #   se     '**;77=2N$$&&I+++-.?@@@M^MM
 
 	
    c                     | d         | d         | d         d}t          j        d	i |}|                    | d         g          }d|v r|d         S dS )
zM
    Returns the access token for authentication as a service principal.
    	authority	client_idclient_credential)r   r   r   scopes)r   access_tokenN )msalConfidentialClientApplicationacquire_token_for_client)r   msal_configccaauth_responses       r   r	   r	   1   s    
 '{3&{3./BC K 
,
;
;{
;
;C00!(+, 1  M &&^,, '&r   paramsc                 P      j          fd}                     |           dS dS )z5
    Azure-specific hook for generating a token.
    Nc                 .    t          j        |           S )N)r   extra_auth_params)r   r   s    r   token_callbackz(azure_token_hook.<locals>.token_callbackJ   s    !&":GDDDr   )r   )r!   set)r   r"   s   ` r   azure_token_hookr$   D   sP     +	E 	E 	E 	E 	E 	


///// ,+r   )F)r   oracledbr   r	   ConnectParamsr$   register_params_hookr   r   r   <module>r(      sv   >  
 
 
 
- - -&	0X3 	0 	0 	0 	0  . / / / / /r   