
    )Jfs                     ~    d dl mZ d dlmZ d dlmZ d dlmZ  eej                  Z	e	j
        Z
 G d d          ZdS )    )import_module)urlparse)settings)patch_vary_headersc                   $    e Zd ZdZd Zd Zd ZdS )LoginSessionaT  Some providers sometimes POST their responses, which due to
    CORS/Samesite-cookie rules means that this request cannot access the session
    as its session cookie is unavailable.

    We work around this by storing the response in a separate, temporary session
    and redirecting to a different endpoint that can pick up the flow.
    c                     || _         || _        || _        t          ||d          | _        | j        F|j                            |          }t          |          | _        t          ||| j                   dS dS )z8
        Prepares an provider specific session.
        N)	requestattribute_namecookie_namegetattrstoreCOOKIESgetSessionStoresetattr)selfr
   r   r   session_keys        a/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/allauth/socialaccount/sessions.py__init__zLoginSession.__init__   s|     ,&Wnd;;
:!/--k::K%k22DJG^TZ88888     c           
      6   t          |d           | j                                         i }t          t          dd          }|r||d<    |j        | j        | j        j        fddt          j        t          |j
                  j        t          j        dd| dS )z4
        Save the session and set a cookie.
        )CookieSESSION_COOKIE_SAMESITENsamesite)max_ageexpiresdomainpathsecurehttponly)r   r   saver   r   
set_cookier   r   SESSION_COOKIE_DOMAINr   urlr   SESSION_COOKIE_SECURE)r   responsekwargsr   s       r   r"   zLoginSession.save"   s     	8[111
8%>EE 	*!)F:J"	
 1(,'',1	
 	
 	
 	
 	
 	
 	
r   c                 8    | j                                          d S )N)r   delete)r   s    r   r*   zLoginSession.delete9   s    
r   N)__name__
__module____qualname____doc__r   r"   r*    r   r   r   r      sK         9 9 9
 
 
.    r   r   N)	importlibr   urllib.parser   django.confr   django.utils.cacher   SESSION_ENGINEenginer   r   r/   r   r   <module>r6      s    # # # # # # ! ! ! ! ! !             1 1 1 1 1 1 
x.	/	/". . . . . . . . . .r   