-1

I have started using Python-Eve to access an existing database. I want use a Token-Based Authentication but for SignIn I want use a Basic Authentication with bcrypt.
I create a specific endpoint:

DOMAIN = {
....
'signin': signin_setting,
....
}

and add to setting a specific auth class

signin_setting = {
'item_title': 'signin',
'authentication': SignIn,
'schema': {}
}

if I write the class SighIn(BasicAuth) in setting.py like the class BCryptAuth(BasicAuth) of tutorial there is an error on call to db app.data.driver.db['accounts'] // obviously haven't app value

if I insert class BCryptAuth(BasicAuth) in run.py and in setting.py I add

from run import BCryptAuth

class SignIn(BCryptAuth): def check_auth(self, username, password, allowed_roles, resource, method):

I not succeed to call the parent function BCryptAuth.check_auth in run.py I have used this calls

auth = BCryptAuth.check_auth(username,password,allowed_roles,resource,method)

auth = super(SignIn, self).check_auth(username, password, allowed_roles, resource, method)

but never they call BCryptAuth class

1 Answers1

0

resolved!

after the import class: from run import BCryptAuth

is possible set the endpoit authentication directly with BCryptAuth