
    qh                     f    S r SSKrSSKJr  SSKJrJr  \R                  " \5      r	 " S S\5      r
g)z
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 RFC6749.
    N)Request   )BaseEndpointcatch_errors_and_unavailabilityc                   l    \ rS rSrSrS r\S 5       r\S 5       r\S 5       r	\
  SS j5       rS	 rS
rg)ResourceEndpoint   ab  Authorizes access to protected resources.

The client accesses protected resources by presenting the access
token to the resource server.  The resource server MUST validate the
access token and ensure that it has not expired and that its scope
covers the requested resource.  The methods used by the resource
server to validate the access token (as well as any error responses)
are beyond the scope of this specification but generally involve an
interaction or coordination between the resource server and the
authorization server::

    # For most cases, returning a 403 should suffice.

The method in which the client utilizes the access token to
authenticate with the resource server depends on the type of access
token issued by the authorization server.  Typically, it involves
using the HTTP "Authorization" request header field [RFC2617] with an
authentication scheme defined by the specification of the access
token type used, such as [RFC6750]::

    # Access tokens may also be provided in query and body
    https://example.com/protected?access_token=kjfch2345sdf   # Query
    access_token=sdf23409df   # Body
c                 H    [         R                  " U 5        X l        Xl        g N)r   __init___tokens_default_token)selfdefault_tokentoken_typess      \/var/www/html/env/lib/python3.13/site-packages/oauthlib/oauth2/rfc6749/endpoints/resource.pyr   ResourceEndpoint.__init__,   s    d#"+    c                     U R                   $ r   )r   r   s    r   r   ResourceEndpoint.default_token1   s    """r   c                 L    U R                   R                  U R                  5      $ r   )tokensgetr   r   s    r   default_token_type_handler+ResourceEndpoint.default_token_type_handler5   s    {{t1122r   c                     U R                   $ r   )r   r   s    r   r   ResourceEndpoint.tokens9   s    ||r   Nc                    [        XX45      nU R                  U5      Ul        XVl        U R                  R                  UR                  U R                  5      n[        R                  SUR                  U5        UR                  U5      U4$ )z0Validate client, code etc, return body + headersz(Dispatching token_type %s request to %r.)
r   find_token_type
token_typescopesr   r   r   logdebugvalidate_request)r   urihttp_methodbodyheadersr"   requesttoken_type_handlers           r   verify_requestResourceEndpoint.verify_request=   s~     #D:!11':![[__W-?-?-1-L-LN		<$$&8	:!227;WDDr   c                    ^ [        U4S jU R                  R                  5        5       SS9n[        U5      (       a  US   S   $ S$ )a  Token type identification.

RFC 6749 does not provide a method for easily differentiating between
different token types during protected resource access. We estimate
the most likely token type (if any) by asking each known token type
to give an estimation based on the request.
c              3   N   >#    U  H  u  pUR                  T5      U4v   M     g 7fr   )estimate_type).0ntr*   s      r   	<genexpr>3ResourceEndpoint.find_token_type.<locals>.<genexpr>R   s(      =(; __W5q9(;s   "%T)reverser   r   N)sortedr   itemslen)r   r*   	estimatess    ` r   r     ResourceEndpoint.find_token_typeJ   sH      =(,(9(9(;=FJL	"%i..y|A:d:r   )r   r   )GETNNN)__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r   r   r,   r    __static_attributes__ r   r   r   r      si    2,
 # # 3 3   %HL"
E %
E
;r   r   )rA   loggingoauthlib.commonr   baser   r   	getLoggerr=   r#   r   rD   r   r   <module>rI      s3     # ?!C;| C;r   