[OpenLayers-Users] Editing against secured WFS-T [SOLVED]

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Thu Mar 17 05:34:41 EDT 2011


For a similar issue, I reverted back to urllib instead of urllib2, which
does pass on the Authorization headers.

import urllib

y = urllib.urlopen(url)

Best regards,
Bart

> Hi list,
>
> I managed to solve this. I modified the proxy.cgi so it passes the
> user/pass token to geoserver. The token is encoded using base64 python
> library:
>
> Add the following at the beginning of the file:
>
> import base64
>
> An then, more or less, at line 53, you will find the section were the
> request headers are set. I've changed the following line:
>
> 	headers = {"Content-Type": os.environ["CONTENT_TYPE"]}
> For
>
> base64string = base64.encodestring('%s:%s' % (username, password))[:-1]
> authheader = "Basic %s" % base64string
> headers = {"Content-Type": os.environ["CONTENT_TYPE"],"Authorization":
> authheader }
>
> Basically, I have a username and a password, I encoded them using base64
> algorithm, and finally I set the header. This approach is for having a
> fixed username/password inside the proxy.cgi. In order to achieve this
> task in a more general way, you could pass the authentication header to
> the proxy, and inside the proxy get that header and pass it again to
> GeoServer.
>
> Hope this can help.
>
> Regards.
>
> Un saludo,
>
> ··················································································
>
> David Alda Fernández de Lezea
> Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
>
> IKT
> Granja Modelo s/n · 01192 · Arkaute (Araba)
>
> ··················································································
> Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
> ··················································································
> email: dalda at ikt.es                                web: www.ikt.es
> ··················································································
>
> -----Mensaje original-----
> De: openlayers-users-bounces at lists.osgeo.org
> [mailto:openlayers-users-bounces at lists.osgeo.org] En nombre de David Alda
> Fernandez de Lezea
> Enviado el: miércoles, 16 de marzo de 2011 15:16
> Para: users at openlayers.org
> Asunto: [OpenLayers-Users] Editing against secured WFS-T
>
> Hi list,
>
> I'm trying to commit some changes to a secured (user & pass) wfs-t
> service. Is there any propertie or something in which I can specify the
> user and pass for http basic authentication?? The problem is that I can't
> figure out how to set these variables to the savestrategy object.
>
> Thanks.
>
> Regards.
>
> Un saludo,
>
> ··················································································
>
> David Alda Fernández de Lezea
> Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
>
> IKT
> Granja Modelo s/n · 01192 · Arkaute (Araba)
>
> ··················································································
> Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
> ··················································································
> email: dalda at ikt.es                                web: www.ikt.es
> ··················································································
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>




More information about the Users mailing list