Try to modify authstate after declaration

This commit is contained in:
Micke Nordin 2024-01-13 16:31:06 +01:00
parent e3540011cf
commit a2aa3d06f4
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257

View file

@ -13,10 +13,14 @@ hub:
oauthCode: | oauthCode: |
import time import time
from oauthenticator.generic import GenericOAuthenticator from oauthenticator.generic import GenericOAuthenticator
def post_auth_hook(authenticator, handler, authentication): def post_auth_hook(authenticator, handler, authentication):
user = authentication['auth_state']['oauth_user']['ocs']['data']['id'] user = authentication['auth_state']['oauth_user']['ocs']['data']['id']
authentication['auth_state']['token_expires'] = time.time() + auth_state['token_response']['expires_in'] auth_state = authentication['auth_state']
auth_state['token_expires'] = time.time() + auth_state['token_response']['expires_in']
authentication['auth_state'] = auth_state
return authentication return authentication
class NextcloudOAuthenticator(GenericOAuthenticator): class NextcloudOAuthenticator(GenericOAuthenticator):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)