o
    i                     @   s\   d dl 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 G dd	 d	eZd
S )    )OptionalAny)AccessTokenAccessTokenInfoTokenRequestOptions   )AsyncContextManager)log_get_token_async   )VisualStudioCodeCredentialc                   @   s   e Zd ZdZdeddfddZdddZdd	d
Zedddde	de
e	 de
e	 dedef
ddZddde	de
e defddZdS )r   a  Authenticates as the Azure user signed in to Visual Studio Code via the 'Azure Resources' extension.

    This currently only works in Windows/WSL environments and requires the 'azure-identity-broker'
    package to be installed.

    :keyword str tenant_id: A Microsoft Entra tenant ID. Defaults to the tenant specified in the authentication
        record file used by the Azure Resources extension.
    :keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
        for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
        acquire tokens for any tenant the application can access.
    kwargsreturnNc                 K   s   t di || _d S )N )SyncVSCodeCredential_sync_credential)selfr   r   r   ]/home/app/Keep/.python/lib/python3.10/site-packages/azure/identity/aio/_credentials/vscode.py__init__   s   z#VisualStudioCodeCredential.__init__c                    s   | j   | S )N)r   	__enter__r   r   r   r   
__aenter__   s   
z%VisualStudioCodeCredential.__aenter__c                    s   | j   dS )z)Close the credential's transport session.N)r   closer   r   r   r   r   !   s   z VisualStudioCodeCredential.closeclaims	tenant_idscopesr   r   c                   s   | j j|||d|S )a  Request an access token for `scopes` as the user currently signed in to Visual Studio Code.

        This method is called automatically by Azure SDK clients.

        :param str scopes: desired scopes for the access token. This method requires at least one scope.
            For more information about scopes, see
            https://learn.microsoft.com/entra/identity-platform/scopes-oidc.
        :keyword str claims: additional claims required in the token, such as those returned in a resource provider's
            claims challenge following an authorization failure.
        :keyword str tenant_id: optional tenant to include in the token request.

        :return: An access token with the desired scopes.
        :rtype: ~azure.core.credentials.AccessToken
        :raises ~azure.identity.CredentialUnavailableError: the credential cannot retrieve user details from Visual
            Studio Code
        r   )r   	get_token)r   r   r   r   r   r   r   r   r   %   s   z$VisualStudioCodeCredential.get_token)optionsr   c                   s   | j j|d|iS )a  Request an access token for `scopes` as the user currently signed in to Visual Studio Code.

        This is an alternative to `get_token` to enable certain scenarios that require additional properties
        on the token. This method is called automatically by Azure SDK clients.

        :param str scopes: desired scopes for the access token. This method requires at least one scope.
            For more information about scopes, see https://learn.microsoft.com/entra/identity-platform/scopes-oidc.
        :keyword options: A dictionary of options for the token request. Unknown options will be ignored. Optional.
        :paramtype options: ~azure.core.credentials.TokenRequestOptions

        :rtype: ~azure.core.credentials.AccessTokenInfo
        :return: An AccessTokenInfo instance containing information about the token.
        :raises ~azure.identity.CredentialUnavailableError: the credential cannot retrieve user details from Visual
          Studio Code.
        r   )r   get_token_info)r   r   r   r   r   r   r   ;   s   z)VisualStudioCodeCredential.get_token_info)r   r   )r   N)__name__
__module____qualname____doc__r   r   r   r   r	   strr   r   r   r   r   r   r   r   r   r   r      s&    

$r   N)typingr   r   Zazure.core.credentialsr   r   r   	_internalr   Z_internal.decoratorsr	   Z_credentials.vscoder   r   r   r   r   r   <module>   s   