Ë
    +Ñ¦h  ã                   óf   — d dl mZ d dlmZ d dlmZ dZ	 	 d
dddddddddddddœd„Z ed	„ «      Zy)é    )Úg)Ú
LocalProxy)ÚOAuth2ConsumerBlueprintz,Steven MARTINS <steven.martins.fr@gmail.com>NÚcommon)ÚscopeÚredirect_urlÚredirect_toÚ	login_urlÚauthorized_urlÚsession_classÚstorageÚtenantÚpromptÚdomain_hintÚ
login_hintÚrule_kwargsc                ó  ‡— |xs g d¢}d|	› d�}d|	› d�}i }|r||d<   |r||d<   |
r|
|d<   t        dt        f| ||d	||d
|v r|nd||||||||dœŽŠd‰j                  d<   d‰j                  d<   ‰j                  ˆfd„«       }‰S )a=  
    Make a blueprint for authenticating with Azure AD using OAuth 2. This requires
    a client ID and client secret from Azure AD. You should either pass them to
    this constructor, or make sure that your Flask application config defines
    them, using the variables :envvar:`AZURE_OAUTH_CLIENT_ID` and
    :envvar:`AZURE_OAUTH_CLIENT_SECRET`.

    Args:
        client_id (str): The client ID for your application on Azure AD.
        client_secret (str): The client secret for your application on Azure AD
        scope (str, optional): comma-separated list of scopes for the OAuth token.
            If the ``offline_access`` scope is included, automatic token refresh
            will be enabled. `See the Azure documentation for more information.
            <https://learn.microsoft.com/en-us/entra/identity-platform/scopes-oidc#the-offline_access-scope>`_
        redirect_url (str): the URL to redirect to after the authentication
            dance is complete
        redirect_to (str): if ``redirect_url`` is not defined, the name of the
            view to redirect to after the authentication dance is complete.
            The actual URL will be determined by :func:`flask.url_for`
        login_url (str, optional): the URL path for the ``login`` view.
            Defaults to ``/azure``
        authorized_url (str, optional): the URL path for the ``authorized`` view.
            Defaults to ``/azure/authorized``.
        session_class (class, optional): The class to use for creating a
            Requests session. Defaults to
            :class:`~flask_dance.consumer.requests.OAuth2Session`.
        storage: A token storage class, or an instance of a token storage
                class, to use for this blueprint. Defaults to
                :class:`~flask_dance.consumer.storage.session.SessionStorage`.
        tenant: Determine which accounts are allowed to authenticate with Azure.
                `See the Azure documentation for more information about this parameter.
                <https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints>`_
                Defaults to ``common``.
        prompt (str, optional): Indicate the type of user interaction that is required.
            Valid values are ``login``, ``select_account``, ``consent``, ``admin_consent``.
            Learn more about the options `here.
            <https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code#request-an-authorization-code>`_
            Defaults to ``None``
        domain_hint (str, optional): Provides a hint about the tenant or domain that
            the user should use to sign in. The value of the domain_hint is a
            registered domain for the tenant. If the tenant is federated to an
            on-premises directory, AAD redirects to the specified tenant federation server.
            Defaults to ``None``
        login_hint (str, optional): Can be used to pre-fill the username/email
            address field of the sign-in page for the user, if you know their
            username ahead of time. Often apps use this parameter during re-authentication,
            having already extracted the username from a previous sign-in using the
            preferred_username claim.
            Defaults to ``None``
        rule_kwargs (dict, optional): Additional arguments that should be passed when adding
            the login and authorized routes. Defaults to ``None``.

    :rtype: :class:`~flask_dance.consumer.OAuth2ConsumerBlueprint`
    :returns: A :doc:`blueprint <flask:blueprints>` to attach to your Flask app.
    )ÚopenidÚemailÚprofilez	User.Readz"https://login.microsoftonline.com/z/oauth2/v2.0/tokenz/oauth2/v2.0/authorizer   r   r   Úazurezhttps://graph.microsoft.comÚoffline_accessN)Ú	client_idÚclient_secretr   Úbase_urlÚauthorization_urlÚ	token_urlÚauto_refresh_urlr   r	   r
   r   Úauthorization_url_paramsr   r   r   ÚAZURE_OAUTH_CLIENT_IDr   ÚAZURE_OAUTH_CLIENT_SECRETr   c                  ó0   •— ‰ j                   t        _        y ©N)Úsessionr   Úflask_dance_azure)Úazure_bps   €úQ/var/www/timesheet/venv/lib/python3.12/site-packages/flask_dance/contrib/azure.pyÚset_applocal_sessionz2make_azure_blueprint.<locals>.set_applocal_sessions   s   ø€ à&×.Ñ.ŒÕó    )r   Ú__name__Úfrom_configÚbefore_app_request)r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r(   r&   s                     @r'   Úmake_azure_blueprintr-   	   só   ø€ ðP Ò@Ò@€EØ4°V°HÐ<NÐO€Ià
,¨V¨HÐ4JÐKð ð  "ÐÙØ1;Ð  Ñ.ÙØ2=Ð  Ñ/ÙØ-3Ð  Ñ*Ü&ØÜðð Ø#ØØ.Ø+ØØ&6¸%Ñ&?™ÀTØ!ØØØ%Ø!9Ø#ØØò#€Hð& )@€H×Ñ˜Ñ%Ø,G€H×Ñ˜Ñ)à× Ñ ó/ó !ð/ð €Or)   c                  ó"   — t         j                  S r#   )r   r%   © r)   r'   ú<lambda>r0   z   s   € œ1×.Ñ.€ r)   )NN)	Úflaskr   Úwerkzeug.localr   Úflask_dance.consumerr   Ú__maintainer__r-   r   r/   r)   r'   ú<module>r5      s[   ðÝ Ý %å 8à?€ð Øðnð ØØØØØØØØØØØônñb 	Ñ.Ó/�r)   