[Cubicweb] Apache authentication: which CubicWeb API?

Dimitri Papadopoulos Orfanos dimitri.papadopoulos at cea.fr
Mon Oct 7 11:39:51 CEST 2013


Hi Nicolas,

I'd love to blog about it, but where? I must be missing something, I 
cannot find a way to add a new entity in the CubicWeb Blog.


Anyway, the code in its current form is as follows:


from mod_python import apache
from cubicweb import dbapi
from cubicweb import AuthenticationError

def authenhandler(req):
     pw = req.get_basic_auth_pw()
     user = req.user

     database = 'zmqpickle-tcp://localhost:8181'
     try:
         cnx = dbapi.connect(database, login=user, password=pw)
     except AuthenticationError:
         return apache.HTTP_UNAUTHORIZED
     else:
         cnx.close()
         return apache.OK

Le 07/10/2013 11:04, Nicolas Chauvat a écrit :
> If the above works for you, please blog about it or provide it as a
> changeset that could be integrated to the documentation or added to a
> tools/ directory in cubicweb (unless someone else has a better idea).

-- 
Dimitri Papadopoulos
CEA/Saclay
I2BM, NeuroSpin
F-91191 Gif-sur-Yvette cedex, France



More information about the Cubicweb mailing list