Skip to content
Permalink
Browse files

Fix QGIS server test HTTP Basic auth with streaming

  • Loading branch information
elpaso committed Nov 2, 2017
1 parent 3919cc2 commit 83ec9de429159787ca97ab53005083cc3f6c3073
Showing with 10 additions and 0 deletions.
  1. +10 −0 tests/src/python/qgis_wrapped_server.py
@@ -90,6 +90,16 @@

class HTTPBasicFilter(QgsServerFilter):

def requestReady(self):
handler = self.serverInterface().requestHandler()
auth = self.serverInterface().requestHandler().requestHeader('HTTP_AUTHORIZATION')
if auth:
username, password = base64.b64decode(auth[6:]).split(b':')
if (username.decode('utf-8') == os.environ.get('QGIS_SERVER_USERNAME', 'username') and
password.decode('utf-8') == os.environ.get('QGIS_SERVER_PASSWORD', 'password')):
return
handler.setParameter('SERVICE', 'ACCESS_DENIED')

def responseComplete(self):
handler = self.serverInterface().requestHandler()
auth = self.serverInterface().requestHandler().requestHeader('HTTP_AUTHORIZATION')

0 comments on commit 83ec9de

Please sign in to comment.
You can’t perform that action at this time.