&`"zdZddlZddlZddlmZmZmZmZmZm Z m Z eje Z GddZdZy)z oauthlib.oauth2.rfc6749 ~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various logic needed for consuming and providing OAuth 2.0 RFC6749. N)FatalClientErrorInvalidClientErrorInvalidRequestError OAuth2Error ServerErrorTemporarilyUnavailableErrorUnsupportedTokenTypeErrorceZdZdZedZej dZedZej dZedZej dZdZ d Z d Z d Z d Z y ) BaseEndpointc.d|_d|_d|_y)NTF) _available _catch_errors_valid_request_methodsselfs H/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/base.py__init__zBaseEndpoint.__init__s"&*#c|jSN)rrs rvalid_request_methodsz"BaseEndpoint.valid_request_methodss***rcZ||Dcgc]}|j}}||_ycc}wr)upperr)rrxs rrz"BaseEndpoint.valid_request_methodss0 ,8M$N1QWWY$N !$N&;#%Os(c|jSrrrs r availablezBaseEndpoint.available%s rc||_yrr)rrs rrzBaseEndpoint.available)s #rc|jSrrrs r catch_errorszBaseEndpoint.catch_errors-s!!!rc||_yrr!)rr"s rr"zBaseEndpoint.catch_errors1s )rc6|js t|dy)zRaise error on missing token.zMissing token parameter.request descriptionN)tokenrrr&s r_raise_on_missing_tokenz$BaseEndpoint._raise_on_missing_token5s"}}%g2LN NrcF|jj|r>|jj|s"tj d|t |y|jj |j|s"tj d|t |y)z&Raise on failed client authentication.z!Client authentication failed, %r.r&N)request_validatorclient_authentication_requiredauthenticate_clientlogdebugrauthenticate_client_id client_idr)s r_raise_on_invalid_clientz%BaseEndpoint._raise_on_invalid_client:s  ! ! @ @ I))==gF =wG(99G''>>w?P?PRYZ II97 C$W5 5[rc|jr>|j|jvr%|j|jvr t|yyy)zRaise on unsupported tokens.r,N)token_type_hintvalid_token_typessupported_token_typesr r)s r_raise_on_unsupported_tokenz(BaseEndpoint._raise_on_unsupported_tokenDsN  # #  # #t'='= =  # #4+E+E E+G< < F > $rc|j td|jj|jvr(t |d|jjzy)Nz0Configure "valid_request_methods" property firstzUnsupported request method %sr%)r ValueError http_methodrrr)s r_raise_on_bad_methodz!BaseEndpoint._raise_on_bad_methodKsf  % % -OP P    $ $ &d.H.H H%g3RU\UhUhUnUnUp3ps s Irc~|jjdk(r |jxsd}|r t|dyy)z/Raise if invalid POST request received POSTz$URL query parameters are not allowedr%N)r<r uri_queryr)rr& query_paramss r_raise_on_bad_post_requestz'BaseEndpoint._raise_on_bad_post_requestRsL    $ $ && 0",,2L)'7]`` 1rN)__name__ __module__ __qualname__rpropertyrsetterrr"r*r4r9r=rCrrr r s+ ++!!<"< $$""**N 6=s`rr cBtjfd}|S)Nc~|js1t}tjd|zi|jdfS|j r ||g|i|S||g|i|S#t $rt$rt$r;}t}tjd|zi|jdfcYd}~Sd}~wwxYw)Nz*Endpoint unavailable, ignoring request %s.iz.Exception caught while processing request, %s.i) rr r0infojsonr"rr Exceptionrwarning)endpointuriargskwargseerrorfs rwrapperz0catch_errors_and_unavailability..wrapper\s!!+-A HHACG Hqvvs? "   +38888Xs4T4V4 4 #  +#  DqHJ5::s**  +s A&&B<0B71B<7B<) functoolswraps)rVrWs` rcatch_errors_and_unavailabilityrZ[s%__Q55( Nr)__doc__rXloggingerrorsrrrrrr r getLoggerrDr0r rZrIrrr_sI g!F`F`Pr