o
    gf                     @   s|   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZ G dd	 d	e
ZG d
d deZdeiZdS )z
Google App Engine support using User API

This backend is for use of django-social-auth on top
of Google's App Engine PaaS.

This backend directly uses Google's User API that
is available on the App Engine platform.
    )absolute_import)users)authenticate)reverse)SocialAuthBackendBaseAuth)AuthExceptionc                   @   s$   e Zd ZdZdZdd Zdd ZdS )
GAEBackendz&GoogleAppengine authentication backendgoogle-appenginec                 C   s   t  }|r
| S dS )zReturn current user id.N)r   get_current_useruser_id)selfdetailsresponseuser r   a/var/www/html/humari/django-venv/lib/python3.10/site-packages/social_auth/backends/contrib/gae.pyget_user_id   s   zGAEBackend.get_user_idc                 C   s    t  }| | ddddS )z2Return user basic information (id and email only). )usernameemailfullname
first_name	last_name)r   r   r   r   )r   r   r   r   r   r   get_user_details   s   zGAEBackend.get_user_detailsN)__name__
__module____qualname____doc__namer   r   r   r   r   r   r	      s
    r	   c                   @   s$   e Zd ZdZeZdd Zdd ZdS )GAEAuthzGoogleAppengine authenticationc                 C   s   t td| jjfdS )zBuild and return complete URL.socialauth_complete)args)r   create_login_urlr   AUTH_BACKENDr   )r   r   r   r   auth_url.   s   zGAEAuth.auth_urlc                 O   s4   t  std|dd| jjdi t|i |S )z3Completes login process, must return user instance.zAuthentication errorr   r   T)r   r   r   updater$   r   r   )r   r"   kwargsr   r   r   auth_complete3   s   zGAEAuth.auth_completeN)r   r   r   r   r	   r$   r%   r(   r   r   r   r   r    *   s
    r    r
   N)r   
__future__r   google.appengine.apir   django.contrib.authr   django.core.urlresolversr   social_auth.backendsr   r   social_auth.exceptionsr   r	   r    BACKENDSr   r   r   r   <module>   s    	