def validate_access_token(self, client_key, resource_owner_key): token = None client = Client.find_one({'client_key':client_key}) if client: token = AccessToken.find_one( {'token':resource_owner_key, 'client_id': client['_id']}) return token != None
def get_access_token_secret(self, client_key, resource_owner_key): client = Client.find_one({'client_key':client_key}) if client: token = AccessToken.find_one( {'token':resource_owner_key, 'client_id': client['_id']}) if token: return token['secret'] return None
def validate_access_token(self, client_key, resource_owner_key): token = None client = Client.find_one({'client_key': client_key}) if client: token = AccessToken.find_one({ 'token': resource_owner_key, 'client_id': client['_id'] }) return token != None
def get_access_token_secret(self, client_key, resource_owner_key): client = Client.find_one({'client_key': client_key}) if client: token = AccessToken.find_one({ 'token': resource_owner_key, 'client_id': client['_id'] }) if token: return token['secret'] return None
def validate_realm(self, client_key, access_token, uri=None, required_realm=None): if not required_realm: return True # insert other check, ie on uri here client = Client.find_one({'client_key':client_key}) if client: token = AccessToken.find_one( {'token':access_token, 'client_id': client['_id']}) if token: return token['realm'] in required_realm return False
def save_timestamp_and_nonce(self, client_key, timestamp, nonce, request_token=None, access_token=None): client = Client.find_one({'client_key':client_key}) if client: nonce = Nonce(nonce, timestamp) nonce.client_id = client['_id'] if request_token: req_token = RequestToken.find_one({'token':request_token}) nonce.request_token_id = req_token['_id'] if access_token: token = AccessToken.find_one({'token':access_token}) nonce.access_token_id = token['_id'] nonce.insert()
def save_timestamp_and_nonce(self, client_key, timestamp, nonce, request_token=None, access_token=None): client = Client.find_one({'client_key': client_key}) if client: nonce = Nonce(nonce, timestamp) nonce.client_id = client['_id'] if request_token: req_token = RequestToken.find_one({'token': request_token}) nonce.request_token_id = req_token['_id'] if access_token: token = AccessToken.find_one({'token': access_token}) nonce.access_token_id = token['_id'] nonce.insert()
def validate_realm(self, client_key, access_token, uri=None, required_realm=None): if not required_realm: return True # insert other check, ie on uri here client = Client.find_one({'client_key': client_key}) if client: token = AccessToken.find_one({ 'token': access_token, 'client_id': client['_id'] }) if token: return token['realm'] in required_realm return False