Skip to content

Commit

Permalink
[#1943] Add timeout and reissue_time to who.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
brew committed Oct 29, 2014
1 parent e909360 commit 878a15b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ckan/config/middleware.py
@@ -1,4 +1,5 @@
"""Pylons middleware initialization"""
import math
import urllib
import urllib2
import logging
Expand Down Expand Up @@ -195,6 +196,8 @@ def make_app(conf, full_stack=True, static_files=True, **app_conf):
def ckan_auth_tkt_make_app(**kw):
if not len(kw.get('secret', '')) or kw.get('secret') == 'somesecret':
kw['secret'] = config['beaker.session.secret']
if kw.get('timeout') and not kw.get('reissue_time'):
kw['reissue_time'] = int(math.ceil(int(kw.get('timeout')) * 0.1))
return auth_tkt_make_plugin(**kw)


Expand Down
8 changes: 6 additions & 2 deletions ckan/config/who.ini
Expand Up @@ -2,6 +2,11 @@
use = ckan.config.middleware:ckan_auth_tkt_make_app
# If no secret key is defined here, beaker.session.secret will be used
#secret = somesecret
# Timeout set in seconds before a non-active session expires (optional).
timeout = 3600 ;One hour
# Time before a session ticket is reissued (optional). If not defined,
# this will be set to 1/10th the timeout value.
# reissue_time = 360

[plugin:friendlyform]
use = repoze.who.plugins.friendlyform:FriendlyFormPlugin
Expand Down Expand Up @@ -49,7 +54,7 @@ plugins =
auth_tkt

[authenticators]
plugins =
plugins =
ckan.lib.authenticator:OpenIDAuthenticator
ckan.lib.authenticator:UsernamePasswordAuthenticator

Expand All @@ -58,4 +63,3 @@ plugins =
openid
friendlyform;browser
# basicauth

0 comments on commit 878a15b

Please sign in to comment.