[auth] remove dead code (closes #5230746)
authorDavid Douard <david.douard@logilab.fr>
Thu, 09 Apr 2015 23:58:38 +0200
changeset 11560 1a816189ceee
parent 11559 136dd873dca2
child 11561 25d93d14f8b6
[auth] remove dead code (closes #5230746)
pyramid_cubicweb/authplugin.py
pyramid_cubicweb/core.py
--- a/pyramid_cubicweb/authplugin.py	Mon Feb 23 17:17:43 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-"""
-Special authentifiers.
-
-:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
-
-"""
-__docformat__ = "restructuredtext en"
-
-from cubicweb import AuthenticationError
-from cubicweb.server.sources import native
-
-
-class Token(object):
-    pass
-
-EXT_TOKEN = Token()
-
-
-class DirectAuthentifier(native.BaseAuthentifier):
-    """return CWUser eid for the given login.
-
-    Before doing so, it makes sure the authentication request is not coming
-    from ouside by checking the special '__externalauth_directauth' kwarg.
-
-    """
-
-    auth_rql = (
-        'Any U WHERE U is CWUser, '
-        'U eid %(eid)s'
-    )
-
-    def authenticate(self, session, login, **kwargs):
-        """Return the CWUser eid for the given login.
-
-        Make sure the request comes from inside pyramid by
-        checking the special '__pyramid_directauth' kwarg.
-
-        """
-        session.debug('authentication by %s', self.__class__.__name__)
-        directauth = kwargs.get('__pyramid_directauth', None)
-        try:
-            if directauth == EXT_TOKEN:
-                rset = session.execute(self.auth_rql, {'eid': int(login)})
-                if rset:
-                    session.debug('Successfully identified %s', login)
-                    return rset[0][0]
-        except Exception, exc:
-            session.debug('authentication failure (%s)', exc)
-
-        raise AuthenticationError('user is not registered')
--- a/pyramid_cubicweb/core.py	Mon Feb 23 17:17:43 2015 +0100
+++ b/pyramid_cubicweb/core.py	Thu Apr 09 23:58:38 2015 +0200
@@ -15,7 +15,7 @@
 
 from pyramid import httpexceptions
 
-from pyramid_cubicweb import authplugin, tools
+from pyramid_cubicweb import tools
 
 import logging
 
@@ -338,8 +338,6 @@
         config.registry['cubicweb.anonymous_eid'] = cnx.find(
             'CWUser', login=login).one().eid
 
-    repo.system_source.add_authentifier(authplugin.DirectAuthentifier())
-
     config.add_request_method(
         _cw_session, name='cw_session', property=True, reify=True)
     config.add_request_method(