diff --git a/ahserver/auth_api.py b/ahserver/auth_api.py index c300d17..14d5d62 100755 --- a/ahserver/auth_api.py +++ b/ahserver/auth_api.py @@ -35,17 +35,15 @@ class AuthAPI(AppLogger): self.getPrivateKey() return self.rsaEngine.decode(self.privatekey,cdata) - def setupAuth(self,app): + async def setupAuth(self,app): # setup session middleware in aiohttp fashion storage = EncryptedCookieStorage(urandom(32)) - """ if self.conf.website.session_redis: url = self.conf.website.session_redis.url # redis = await aioredis.from_url("redis://127.0.0.1:6379") redis = await aioredis.from_url(url) storage = aiohttp_session.redis_storage.RedisStorage(redis) - """ aiohttp_session.setup(app, storage) # Create an auth ticket mechanism that expires after 1 minute (60 diff --git a/ahserver/configuredServer.py b/ahserver/configuredServer.py index 61e8a49..ac60eb0 100755 --- a/ahserver/configuredServer.py +++ b/ahserver/configuredServer.py @@ -39,10 +39,13 @@ class ConfiguredServer(AppLogger): print(f'{client_max_size=}') self.app = web.Application(client_max_size=client_max_size) - - def run(self): + + async def init_auth(self): auth = self.auth_klass() - auth.setupAuth(self.app) + await auth.setupAuth(self.app) + return self.app + + def run(self): config = getConfig() self.configPath(config) a = TmpFileRecord() @@ -52,7 +55,7 @@ class ConfiguredServer(AppLogger): ssl_context.load_cert_chain(config.website.ssl.crtfile, config.website.ssl.keyfile) - web.run_app(self.app,host=config.website.host or '0.0.0.0', + web.run_app(self.init_auth(),host=config.website.host or '0.0.0.0', port=config.website.port or 8080, ssl_context=ssl_context)