2019-07-10 17:34:45 +08:00
|
|
|
from ahserver.configuredServer import ConfiguredServer
|
2019-07-10 18:42:54 +08:00
|
|
|
from ahserver.auth_api import AuthAPI
|
2019-07-10 17:34:45 +08:00
|
|
|
|
2019-07-10 18:42:54 +08:00
|
|
|
"""
|
|
|
|
need to implement your AuthAPI
|
|
|
|
class MyAuthAPI:
|
|
|
|
def needAuth(self,path):
|
|
|
|
return Fasle # do not need authentication
|
|
|
|
return True # need authentication
|
|
|
|
|
|
|
|
async def getPermissionNeed(self,path):
|
|
|
|
return 'admin'
|
|
|
|
|
|
|
|
async def checkUserPassword(self,user_id,password):
|
|
|
|
return True
|
|
|
|
|
|
|
|
async def getUserPermissions(self,user):
|
|
|
|
return ['admin','view']
|
|
|
|
"""
|
2019-07-10 17:34:45 +08:00
|
|
|
if __name__ == '__main__':
|
2019-07-10 18:42:54 +08:00
|
|
|
server = ConfiguredServer(AuthAPI)
|
2019-07-10 17:34:45 +08:00
|
|
|
server.run()
|