From 5e20a47bf4b841bfc519be9764f3e2d6ca8ed847 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Fri, 2 Feb 2018 18:00:09 +0530 Subject: [PATCH] sso: Increase timeout to 60 minutes This is a temporary measure since no permanent solution was found for the cases where auth_pubtkt cookie refresh fails when an application sends POST requests only during the time a cookie refresh must happen. e.g. transmission and tt-rss This at least makes the above applications usable for an hour. And then the user must refresh the application on their web browser. This does not affect the mobile apps. The only other option for now is to disable SSO for the above applications till we implement a better SSO solution which is undesirable since our users are already used to the SSO feature. Signed-off-by: Joseph Nuthalapati Reviewed-by: James Valleroy --- actions/auth-pubtkt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/actions/auth-pubtkt b/actions/auth-pubtkt index 752c8329a..2204bb8c7 100755 --- a/actions/auth-pubtkt +++ b/actions/auth-pubtkt @@ -123,16 +123,15 @@ def subcommand_generate_ticket(arguments): tokens = arguments.tokens with open(private_key_file, 'r') as fil: pkey = crypto.load_privatekey(crypto.FILETYPE_PEM, fil.read().encode()) - valid_until = seconds_from_now(30) - grace_period = seconds_from_now(25) - print(create_ticket( - pkey, uid, valid_until, tokens=tokens, graceperiod=grace_period)) + valid_until = minutes_from_now(60) + grace_period = minutes_from_now(55) + print(create_ticket(pkey, uid, valid_until, tokens=tokens, + graceperiod=grace_period)) -# def minutes_from_now(minutes): -# """Return a timestamp at the given number of minutes from now.""" -# return (datetime.datetime.now() + datetime.timedelta( -# 0, minutes * 60)).timestamp() +def minutes_from_now(minutes): + """Return a timestamp at the given number of minutes from now.""" + return seconds_from_now(minutes * 60) def seconds_from_now(seconds):