I am using eve's set_mongo_prefix()
hook within a custom authentication class which works well.
class ServerTokenAuth(TokenAuth):
def check_auth(self, token, allowed_roles, resource, method):
tokens = app.data.driver.db['owner_token_mapping']
mapping = tokens.find_one({'token': token})
if mapping is not None and token == mapping['token']:
add_db_to_config(app, mapping['slug'])
self.set_mongo_prefix(mapping['slug'])
return True
return False
My question is, how do I tell eve's db driver to set_mongo_prefix
? The work around is to use requests to re-authenticate, which is really not ideal.
cheers.