
    qhW                         S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	   " S S	\5      r
 " S
 S\
5      r " S S\\	5      r " S S\\	5      r " S S\
\5      rg)z
Google OpenId, OAuth2, OAuth1, Google+ Sign-in backends, docs at:
    https://python-social-auth.readthedocs.io/en/latest/backends/google.html
    )BaseAuth   )AuthMissingParameter)handle_http_errors   )
BaseOAuth1
BaseOAuth2c                        \ rS rSrS rS rSrg)BaseGoogleAuth   c                 Z    U R                  SS5      (       a  SU;   a  US   $ US   $ US   $ )zUse google email as unique idUSE_UNIQUE_USER_IDFsubidemail)setting)selfdetailsresponses      M/var/www/html/env/lib/python3.13/site-packages/social_core/backends/google.pyget_user_idBaseGoogleAuth.get_user_id   s;    <<,e44 &D>!w    c                     UR                  SS5      nUR                  SS5      UR                  SS5      UR                  SS5      pTnU R                  X4U5      u  pgnUR                  SS5      S   UUUUS	.$ )
z+Return user details from Google API accountr    name
given_namefamily_name@r   r   )usernamer   fullname
first_name	last_name)getget_user_namessplit)	r   r   r   r   r   r   r!   r"   r#   s	            r   get_user_detailsBaseGoogleAuth.get_user_details   s    Wb) LL$LLr*LL+ & +/*=*=k+
'i C+A. $"
 	
r    N)__name__
__module____qualname____firstlineno__r   r'   __static_attributes__r)   r   r   r   r      s     
r   r   c                   &    \ rS rSrS rS rS rSrg)BaseGoogleOAuth2API,   c                 ,    U R                  SSSU 30S9$ ) Return user data from Google APIz-https://www.googleapis.com/oauth2/v3/userinfoAuthorizationzBearer )headers)get_jsonr   access_tokenargskwargss       r   	user_dataBaseGoogleOAuth2API.user_data-   s,    }};7<.!9  
 	
r   c                 
    SU0$ )Ntokenr)   r   r>   uids      r   revoke_token_params'BaseGoogleOAuth2API.revoke_token_params6   s    r   c                 
    SS0$ )NzContent-typezapplication/jsonr)   r?   s      r   revoke_token_headers(BaseGoogleOAuth2API.revoke_token_headers9   s     233r   r)   N)r*   r+   r,   r-   r;   rA   rD   r.   r)   r   r   r0   r0   ,   s    
 4r   r0   c                   @    \ rS rSrSrSrSrSrSrSr	Sr
/ S	Qr/ S
QrSrg)GoogleOAuth2=   z$Google OAuth2 authentication backendzgoogle-oauth2F)https://accounts.google.com/o/oauth2/auth*https://accounts.google.com/o/oauth2/token+https://accounts.google.com/o/oauth2/revokeGET)openidr   profile)refresh_tokenrP   T
expires_inexpires)
token_typerT   Tr)   N)r*   r+   r,   r-   __doc__r   REDIRECT_STATEAUTHORIZATION_URLACCESS_TOKEN_URLREVOKE_TOKEN_URLREVOKE_TOKEN_METHODDEFAULT_SCOPE
EXTRA_DATAr.   r)   r   r   rG   rG   =   s3    .DNCCD2MJr   rG   c                   t   ^  \ rS rSrSrSrSrSrSrSr	Sr
SS	/r/ S
QrSU 4S jjr\S 5       rU 4S jrSrU =r$ )GooglePlusAuthO   zgoogle-plusFrI   rJ   rK   rL   z*https://www.googleapis.com/auth/plus.loginz'https://www.googleapis.com/auth/plus.me))r   user_idrO   rQ   )access_typera   T)coderb   c                 p   > [         TU ]  U5      nU R                  R                  S5      (       a  SUS'   U$ )Nr8   postmessageredirect_uri)superauth_complete_paramsdatar$   )r   stateparams	__class__s      r   rg   #GooglePlusAuth.auth_complete_paramsc   s4    -e499==((%2F>"r   c                 d   SU R                   ;   aV  U R                   R                  S5      nU R                  SSU0S9nU R                  U5        U R                  " U/UQ7SU0UD6$ SU R                   ;   an  U R                  U R                  U R                  5       U R                  5       U R                  S9nU R                  U5        U R                  " US   /UQ7SU0UD6$ SU R                   ;   a1  U R                   R                  S5      nU R                  " U/UQ70 UD6$ [        U S5      e)	Nr8   .https://www.googleapis.com/oauth2/v3/tokeninforj   r   rb   )rh   r5   methodid_tokenzaccess_token, id_token, or code)rh   r$   r6   process_errordo_authrequest_access_tokenrX   rg   auth_headersACCESS_TOKEN_METHODr   )r   r9   r:   r>   r   s        r   auth_completeGooglePlusAuth.auth_completej   s?   TYY&IIMM.1E}}@&. % H x(<<J4JJ6JJTYY00%%..0))+//	 1 H x(<<(>B3;FL  "IIMM*-E<<7777"4)JKKr   c                    > SU R                   ;  a  [        TU ]  " U/UQ70 UD6$ U R                  SSU0S9nU R	                  U5        U$ )Nrq   rn   ro   )rh   rf   r;   r6   rr   )r   r8   r9   r:   r   rk   s        r   r;   GooglePlusAuth.user_data   s\    TYY&7$\CDCFCC==<- ! 
 	8$r   r)   )N)r*   r+   r,   r-   r   rV   STATE_PARAMETERrW   rX   rY   rZ   r[   r\   rg   r   rw   r;   r.   __classcell__rk   s   @r   r^   r^   O   sc    DNOCCD41MJ L L2 r   r^   c                   H   ^  \ rS rSrSrSrSrSrSrS/r	S r
U 4S	 jrS
rU =r$ )GoogleOAuth   z$Google OAuth authorization mechanismzgoogle-oauthz3https://www.google.com/accounts/OAuthAuthorizeTokenz4https://www.google.com/accounts/OAuthGetRequestTokenz3https://www.google.com/accounts/OAuthGetAccessTokenz.https://www.googleapis.com/auth/userinfo#emailc                 @    U R                  SU R                  U5      S9$ )r3   z)https://www.googleapis.com/userinfo/email)auth)get_querystring
oauth_authr7   s       r   r;   GoogleOAuth.user_data   s)    ##7. $ 
 	
r   c                 4   > [         TU ]  5       nUS:X  a  SnU$ )a  Return Google OAuth Consumer Key and Consumer Secret pair, uses
anonymous by default, beware that this marks the application as not
registered and a security badge is displayed on authorization page.
http://code.google.com/apis/accounts/docs/OAuth_ref.html#SigningOAuth
)NN)	anonymousr   )rf   get_key_and_secret)r   
key_secretrk   s     r   r   GoogleOAuth.get_key_and_secret   s%     W/1
%3Jr   r)   )r*   r+   r,   r-   rU   r   rW   REQUEST_TOKEN_URLrX   r[   r;   r   r.   r|   r}   s   @r   r   r      s4    .DMNLEFM
	 	r   r   N)rU   social_core.backends.baser   
exceptionsr   utilsr   oauthr   r	   r   r0   rG   r^   r   r)   r   r   <module>r      s]   
 / - & )
X 
>4. 4"&
 $=(* =@.* r   