o
    &zh)  ã                   @   sJ   d dl Z d dlmZmZmZ d dlmZ d dlmZ G dd„ de j	ƒZ
dS )é    N)ÚAnyÚDictÚOptional)ÚSessionBase)ÚHttpRequestc                   @   sŠ   e Zd Zdedee fdd„Zdedeeeef  fdd„Z	dedee fdd„Z
ejdedefd	d
„ƒZejdedee fdd„ƒZdS )ÚAbstractTokenStrategyÚrequestÚreturnc                 C   s   |j  d¡}|S )z4
        Returns the session token, if any.
        zx-session-token)ÚheadersÚget)Úselfr   Útoken© r   úW/var/www/html/kangema/venv/lib/python3.10/site-packages/allauth/headless/tokens/base.pyÚget_session_token	   s   z'AbstractTokenStrategy.get_session_tokenc                 C   s   |   |¡}|s	dS d|iS )zã
        After authenticating, this method is called to create the access
        token response payload, exposing the access token and possibly other
        information such as a ``refresh_token`` and ``expires_in``.
        NÚaccess_token)Úcreate_access_token)r   r   Úatr   r   r   Úcreate_access_token_payload   s   
z1AbstractTokenStrategy.create_access_token_payloadc                 C   ó   dS )aŒ  Create an access token.

        While session tokens are required to handle the authentication process,
        depending on your requirements, a different type of token may be needed
        once authenticated.

        For example, your app likely needs access to other APIs as well. These
        APIs may even be implemented using different technologies, in which case
        having a stateless token, possibly a JWT encoding the user ID, might be
        a good fit.

        We make no assumptions in this regard. If you need access tokens, you
        will have to implement a token strategy that returns an access token
        here.
        Nr   ©r   r   r   r   r   r      s   z)AbstractTokenStrategy.create_access_tokenc                 C   r   )zC
        Create a session token for the `request.session`.
        Nr   r   r   r   r   Úcreate_session_token/   s   z*AbstractTokenStrategy.create_session_tokenÚsession_tokenc                 C   r   )zˆ
        Looks up the Django session given the session token. Returns `None`
        if the session does not / no longer exist.
        Nr   )r   r   r   r   r   Úlookup_session6   s   z$AbstractTokenStrategy.lookup_sessionN)Ú__name__Ú
__module__Ú__qualname__r   r   Ústrr   r   r   r   r   ÚabcÚabstractmethodr   r   r   r   r   r   r   r      s    ÿ
þr   )r   Útypingr   r   r   Ú%django.contrib.sessions.backends.baser   Údjango.httpr   ÚABCr   r   r   r   r   Ú<module>   s
    