
    D6it                         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dddddddd	d
dd
dZ
 ed       Zy)    )g)
LocalProxy)OAuth2ConsumerBlueprint)OAuth2Sessionz'Justin Georgeson <jgeorgeson@lopht.net>c                        e Zd Z fdZ xZS )NoVerifyOAuth2Sessionc                 2    t        |   |i | d| _        y )NF)super__init__verify)selfargskwargs	__class__s      ]/home/azureuser/techstart-app/venv/lib/python3.12/site-packages/flask_dance/contrib/gitlab.pyr   zNoVerifyOAuth2Session.__init__   s    $)&)    )__name__
__module____qualname__r   __classcell__)r   s   @r   r   r   
   s     r   r   Nz
gitlab.comT)
scoperedirect_urlredirect_to	login_urlauthorized_urlsession_classstoragehostnameverify_tls_certificatesrule_kwargsc       
             |
s|rt        d      t        }t        dt        | ||d|	 dd|	 dd|	 d||||||d|
i|      d	j                  d
<   dj                  d<   j
                  fd       }S )a  
    Make a blueprint for authenticating with GitLab using OAuth 2. This requires
    a client ID and client secret from GitLab. You should either pass them to
    this constructor, or make sure that your Flask application config defines
    them, using the variables :envvar:`GITLAB_OAUTH_CLIENT_ID` and
    :envvar:`GITLAB_OAUTH_CLIENT_SECRET`.

    Args:
        client_id (str): The client ID for your application on GitLab.
        client_secret (str): The client secret for your application on GitLab
        scope (str, optional): comma-separated list of scopes for the OAuth token
        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 ``/gitlab``
        authorized_url (str, optional): the URL path for the ``authorized`` view.
            Defaults to ``/gitlab/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`.
        hostname (str, optional): If using a private instance of GitLab CE/EE,
            specify the hostname, default is ``gitlab.com``.
        verify_tls_certificates (bool, optional): Specify whether TLS
            certificates should be verified. Set this to ``False`` if
            certificates fail to validate for self-hosted GitLab instances.
        rule_kwargs (dict, optional): Additional arguments that should be passed when adding
            the login and authorized routes. Defaults to ``None``.
            specify the hostname, default is ``gitlab.com``

    :rtype: :class:`~flask_dance.consumer.OAuth2ConsumerBlueprint`
    :returns: A :doc:`blueprint <flask:blueprints>` to attach to your Flask app.
    z@cannot override session_class and disable certificate validationgitlabzhttps://z/api/v4/z/oauth/authorizez/oauth/tokenr   )	client_idclient_secretr   base_urlauthorization_url	token_urlr   r   r   r   r   r   token_url_paramsr    GITLAB_OAUTH_CLIENT_IDr#   GITLAB_OAUTH_CLIENT_SECRETr$   c                  0     j                   t        _        y N)sessionr   flask_dance_gitlab)	gitlab_bps   r   set_applocal_sessionz3make_gitlab_blueprint.<locals>.set_applocal_sessionb   s    (00r   )
ValueErrorr   r   r   from_configbefore_app_request)r#   r$   r   r   r   r   r   r   r   r   r   r    r0   r/   s                @r   make_gitlab_blueprintr4      s    j #R  2M'#H:X.$XJ.>?XJl3!%#"$;<!I$ *BI+&-II/*!!1 "1 r   c                  "    t         j                  S r,   )r   r.    r   r   <lambda>r7   i   s    A00 r   )NN)flaskr   werkzeug.localr   flask_dance.consumerr   flask_dance.consumer.requestsr   __maintainer__r   r4   r"   r6   r   r   <module>r=      sd     % 8 7:M  V  Vr 
0	1r   