[Cubicweb] Apache authentication: which CubicWeb API?

Nicolas Chauvat nicolas.chauvat at logilab.fr
Mon Oct 7 11:04:21 CEST 2013


Hello Dimitri,

On Mon, Oct 07, 2013 at 10:36:36AM +0200, Sylvain Thénault wrote:
> Is there any problem with the code below ? it sounds good to me, beside that you
> should close the opened connection before returning.
>  
> > 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
> > 
> >     try:
> >         database = 'zmqpickle-tcp://localhost:8181'
> >         dbapi.connect(database, login=user, password=pw)
> >         return apache.OK
> >     except AuthenticationError:
> >         return apache.HTTP_UNAUTHORIZED

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).

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  



More information about the Cubicweb mailing list