web/views/authentication.py
branchtls-sprint
changeset 1668 d2ac1d681d70
parent 1490 6b024694d493
child 1690 e4f7d2ddc99a
equal deleted inserted replaced
1667:145af5f29f12 1668:d2ac1d681d70
     1 """user authentication component
     1 """user authentication component
     2 
     2 
     3 :organization: Logilab
     3 :organization: Logilab
     4 :copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 """
     6 """
     7 __docformat__ = "restructuredtext en"
     7 __docformat__ = "restructuredtext en"
     8 
     8 
     9 from logilab.common.decorators import clear_cache
     9 from logilab.common.decorators import clear_cache
    10 
    10 
    11 from cubicweb import AuthenticationError, BadConnectionId
    11 from cubicweb import AuthenticationError, BadConnectionId
    12 from cubicweb.dbapi import repo_connect, ConnectionProperties
    12 from cubicweb.dbapi import repo_connect, ConnectionProperties
    13 from cubicweb.web import ExplicitLogin, InvalidSession
    13 from cubicweb.web import ExplicitLogin, InvalidSession
    14 from cubicweb.web.application import AbstractAuthenticationManager
    14 from cubicweb.web.application import AbstractAuthenticationManager
    15     
    15 
    16 
    16 
    17 class RepositoryAuthenticationManager(AbstractAuthenticationManager):
    17 class RepositoryAuthenticationManager(AbstractAuthenticationManager):
    18     """authenticate user associated to a request and check session validity"""
    18     """authenticate user associated to a request and check session validity"""
    19     
    19 
    20     def __init__(self):
    20     def __init__(self):
    21         self.repo = self.config.repository(self.vreg)
    21         self.repo = self.config.repository(self.vreg)
    22         self.log_queries = self.config['query-log-file']
    22         self.log_queries = self.config['query-log-file']
    23 
    23 
    24     def validate_session(self, req, session):
    24     def validate_session(self, req, session):