
    ^hv                     "    S SK Jr  S\S\4S jrg)    )UserAPIKeyAuthtokenreturnc                 x  #    SSK nSSKnSSKJn  SSKJnJn  SSKJn  SSK	J
n  USLa"  [        SUR                  R                  -   5      eUR                  S	U 5        UR                  S
5      nUR                   R#                  SS5      n	UR                   R#                  SS5      n
UR                   R#                  SS5      nU(       d  [        S5      eU" UR$                  S9nSU  3SS.n UR#                  XS9I Sh  vN nUR'                  5         UR)                  5       nUR                  SU U5        UR#                  U	5      nUR#                  U5      nUR#                  U
5      n[+        U UUUS9$  Nv! UR,                   a  n[        SU 35      eSnAf[.         a  n[        SU 35      eSnAff = f7f)a  
Makes a request to the token info endpoint to validate the OAuth2 token.

Args:
token (str): The OAuth2 token to validate.

Returns:
Literal[True]: If the token is valid.

Raises:
ValueError: If the token is invalid, the request fails, or the token info endpoint is not set.
r   N)verbose_proxy_logger)get_async_httpx_clienthttpxSpecialProvider)CommonProxyErrors)premium_userTz;Oauth2 token validation is only available for premium usersz$Oauth2 token validation for token=%sOAUTH_TOKEN_INFO_ENDPOINTOAUTH_USER_ID_FIELD_NAMEsubOAUTH_USER_ROLE_FIELD_NAMEroleOAUTH_USER_TEAM_ID_FIELD_NAMEteam_idz9OAUTH_TOKEN_INFO_ENDPOINT environment variable is not set)llm_providerzBearer zapplication/json)AuthorizationzContent-Type)headerszBOauth2 token validation for token=%s, response from /token/info=%s)api_keyr   user_id	user_rolez#Oauth 2.0 Token validation failed: z+An error occurred during token validation: )oshttpxlitellm._loggingr   &litellm.llms.custom_httpx.http_handlerr   r	   litellm.proxy._typesr
   litellm.proxy.proxy_serverr   
ValueErrornot_premium_uservaluedebuggetenvenvirongetOauth2Checkraise_for_statusjsonr   HTTPStatusError	Exception)r   r   r   r   r   r	   r
   r   token_info_endpointuser_id_field_nameuser_role_field_nameuser_team_id_field_nameclientr   responsedatar   user_team_idr   es                       Y/home/james-whalen/.local/lib/python3.13/site-packages/litellm/proxy/auth/oauth2_check.pycheck_oauth2_tokenr5      s     5 774I00667
 	

 EuM))$?@(BEJ::>>*FO jjnn-LiXTUU#1E1Q1QRF")% 1CUVG L$7II 	!!# }}""P	
 ((-.xx 78HH12	 	
 	
) J4    D>qcBCC LFqcJKKLsI   C+F:.E9  E7A5E9 6F:7E9 9F7	FF7$F22F77F:N)r   r   strr5        r4   <module>r9      s!    /LLC LLN LLr8   