Hi people, i need to know how could i authenticate via openlayers in  
geoserver, i have this:
//////////////////////////////////////////////////////////////
OpenLayers.Request.issue({
method : "POST",
url: " http://localhost:8080/geoserver/j_spring_security_check ",
headers : { username : 'admin',password : 'geoserver' },
params: {
                 username: "admin",
                 password: "geoserver"
         }
});
//////////////////////////////////////////////////////////////
but it dont work to wfs cause the error says this

"This proxy does not allow you to access that location  
(admin:geoserver@localhost:8080)."

and my proxy.cgi is this:
//////////////////////////////////////////////////////////////
#!c:/Python25/python.exe -u


"""This is a blind proxy that we use to get around browser
restrictions that prevent the Javascript from loading pages not on the
same server as the Javascript.  This has several problems: it's less
efficient, it might break some sites, and it's a security risk because
people can use this proxy to browse the web and possibly do bad stuff
with it.  It only loads pages via http and https, but it can load any
content type. It supports GET and POST requests."""

import urllib2
import cgi
import sys, os

# Designed to prevent Open Proxy type stuff.

allowedHosts = ['www.openlayers.org', 'openlayers.org',
                 'labs.metacarta.com', 'world.freemap.in',
                 'prototype.openmnnd.org', 'geo.openplans.org',
                 'sigma.openplans.org', 'demo.opengeo.org',
                 'www.openstreetmap.org', 'sample.azavea.com',
                 'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
                 'vmap0.tiles.osgeo.org', 'www.openrouteservice.org',
                                'localhost', 'localhost:8080']

method = os.environ["REQUEST_METHOD"]

if method == "POST":
     qs = os.environ["QUERY_STRING"]
     d = cgi.parse_qs(qs)
     if d.has_key("url"):
         url = d["url"][0]
     else:
         url = "http://localhost/ol";
else:
     fs = cgi.FieldStorage()
     url = fs.getvalue('url', "http://localhost/ol";)

try:
     host = url.split("/")[2]
     if allowedHosts and not host in allowedHosts:
         print "Status: 502 Bad Gateway"
         print "Content-Type: text/plain"
         print
         print "This proxy does not allow you to access that location  
(%s)." % (host,)
         print
         print os.environ

     elif url.startswith("http://";) or url.startswith("https://";):

         if method == "POST":
             length = int(os.environ["CONTENT_LENGTH"])
             headers = {"Content-Type": os.environ["CONTENT_TYPE"]}
             body = sys.stdin.read(length)
             r = urllib2.Request(url, body, headers)
             y = urllib2.urlopen(r)
         else:
             y = urllib2.urlopen(url)

         # print content type header
         i = y.info()
         if i.has_key("Content-Type"):
             print "Content-Type: %s" % (i["Content-Type"])
         else:
             print "Content-Type: text/plain"
         print

         print y.read()

         y.close()
     else:
         print "Content-Type: text/plain"
         print
         print "Illegal request."

except Exception, E:
     print "Status: 500 Unexpected Error"
     print "Content-Type: text/plain"
     print
     print "Some unexpected error occurred. Error text was:", E

//////////////////////////////////////////////////////////////
thanks to all.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to