This commit is contained in:
yumoqing 2023-06-12 14:05:23 +08:00
parent 7ab886347b
commit 286c8a6c44

View File

@ -13,11 +13,11 @@ from appPublic.app_logger import AppLogger
class AuthAPI(AppLogger):
def __init__(self):
super().__init__()
self.conf = getConfig()
def getPrivateKey(self):
if not hasattr(self,'rsaEngine'):
self.rsaEngine = RSA()
self.conf = getConfig()
fname = self.conf.website.rsakey.privatekey
self.privatekey = self.rsaEngine.read_privatekey(fname)
return self.privatekey
@ -34,8 +34,15 @@ class AuthAPI(AppLogger):
# Create an auth ticket mechanism that expires after 1 minute (60
# seconds), and has a randomly generated secret. Also includes the
# optional inclusion of the users IP address in the hash
policy = auth.SessionTktAuthentication(urandom(32), 120,
reissue_time=100,
session_max_time = 120
session_reissue_time = 30
if self.conf.website.session_max_time:
session_max_time = self.conf.website.session_max_time
if self.conf.website.session_reissue_time:
session_reissue_time = self.conf.website.session_reissue_time
policy = auth.SessionTktAuthentication(urandom(32), session_max_time,
reissue_time=30,
include_ip=True)
# setup aiohttp_auth.auth middleware in aiohttp fashion