<s> from __future__ import absolute_import , unicode_literals <EOL> """<STR_LIT>""" <EOL> from oauthlib . common import log <EOL> from . base import BaseEndpoint <EOL> from . . import errors <EOL> class ResourceEndpoint ( BaseEndpoint ) : <EOL> """<STR_LIT>""" <EOL> def validate_protected_resource_request ( self , uri , http_method = '<STR_LIT:GET>' , <EOL> body = None , headers = None , realms = None ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> request = self . _create_request ( uri , http_method , body , headers ) <EOL> except errors . OAuth1Error : <EOL> return False , None <EOL> try : <EOL> self . _check_transport_security ( request ) <EOL> self . _check_mandatory_parameters ( request ) <EOL> except errors . OAuth1Error : <EOL> return False , request <EOL> if not request . resource_owner_key : <EOL> return False , request <EOL> if not self . request_validator . check_access_token ( <EOL> request . resource_owner_key ) : <EOL> return False , request <EOL> if not self . request_validator . validate_timestamp_and_nonce ( <EOL> request . client_key , request . timestamp , request . nonce , request , <EOL> access_token = request . resource_owner_key ) : <EOL> return False , request <EOL> valid_client = self . request_validator . validate_client_key ( <EOL> request . client_key , request ) <EOL> if not valid_client : <EOL> request . client_key = self . request_validator . dummy_client <EOL> valid_resource_owner = self . request_validator . validate_access_token ( <EOL> request . client_key , request . resource_owner_key , request ) <EOL> if not valid_resource_owner : <EOL> request . resource_owner_key = self . request_validator . dummy_access_token <EOL> valid_realm = self . request_validator . validate_realms ( request . client_key , <EOL> request . resource_owner_key , request , uri = request . uri , <EOL> realms = realms ) <EOL> valid_signature = self . _check_signature ( request ) <EOL> v = all ( ( valid_client , valid_resource_owner , valid_realm , <EOL> valid_signature ) ) <EOL> if not v : <EOL> log . info ( "<STR_LIT>" ) <EOL> log . info ( "<STR_LIT>" , valid_client ) <EOL> log . info ( "<STR_LIT>" , valid_resource_owner ) <EOL> log . info ( "<STR_LIT>" , valid_realm ) <EOL> log . info ( "<STR_LIT>" , valid_signature ) <EOL> return v , request </s>
