def make_auth_cookie(app, global_conf, cookie_name='PASTE_AUTH_COOKIE', scanlist=('REMOTE_USER', 'REMOTE_SESSION'), secret=None, timeout=30, maxlen=4096):
 if isinstance(scanlist, six.string_types):
  scanlist = scanlist.split()
 if ((secret is None) and global_conf.get('secret')):
  secret = global_conf['secret']
 try:
  timeout = int(timeout)
 except ValueError:
  raise ValueError(('Bad value for timeout (must be int): %r' % timeout))
 try:
  maxlen = int(maxlen)
 except ValueError:
  raise ValueError(('Bad value for maxlen (must be int): %r' % maxlen))
 return AuthCookieHandler(app, cookie_name=cookie_name, scanlist=scanlist, secret=secret, timeout=timeout, maxlen=maxlen)

def make_auth_cookie ( app , global_conf , cookie_name = 'PASTE_AUTH_COOKIE' , scanlist = ( 'REMOTE_USER' , 'REMOTE_SESSION' ) , secret = None , timeout = 30 , maxlen = 4096 ) : if isinstance ( scanlist , six . string_types ) : scanlist = scanlist . split ( ) if ( ( secret is None ) and global_conf . get ( 'secret' ) ) : secret = global_conf [ 'secret' ] try : timeout = int ( timeout ) except ValueError : raise ValueError ( ( 'Bad value for timeout (must be int): %r' % timeout ) ) try : maxlen = int ( maxlen ) except ValueError : raise ValueError ( ( 'Bad value for maxlen (must be int): %r' % maxlen ) ) return AuthCookieHandler ( app , cookie_name = cookie_name , scanlist = scanlist , secret = secret , timeout = timeout , maxlen = maxlen )
this middleware uses cookies to stash-away a previously authenticated user so that re-authentication is not needed .