I have user auth working well in cherrypy with code below.
The problem I'm having is that if the target database of users gets updated - e.g. user adds or updates a password, cherrypy doesn't seem to know about it because it only brings in the data once at launch via below 'get_users()' method. the get_users simply returns a manual key value dict scraped form a pymongo_db.
Restarting cherrpy 'solves' the problem, but obviously realtime connection or update is needed.
I've tried setting basic_auth.users to just method name rather than the data coming from an actual call, and also best guesses at cherrypy config update calls, but no joy.
Can't find update examples either.
No luck with direct setting to pymongo db either.
Would greatly appreciate it if anyone out there has some pointers.
auth_users_config = {
'tools.basic_auth.on': True,
'tools.basic_auth.users': get_users(),
'tools.basic_auth.realm': 'some.place.out.there',
'tools.basic_auth.encrypt': pwe
}
.....
sslConfig = {
# Users access:
'/ExternalResource': auth_users_config,
.....
https_cp_app = cherrypy.tree.mount(
api_sub_domain_container.dev,
'/a_mount',
sslConfig)