aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http
diff options
context:
space:
mode:
authorThomas Kriechbaumer <Kriechi@users.noreply.github.com>2016-08-16 10:07:59 +0200
committerGitHub <noreply@github.com>2016-08-16 10:07:59 +0200
commit17c65e46cbdcf328dff22acaf4de8704119678ff (patch)
treefe8ba75b97ab565c6549a3a60e2b9ce0a454da61 /netlib/http
parentf9f0ac848e8a691a78d4458f3d25f21b3e943658 (diff)
parenta9401472cd8002f6e35da8f180400a8b980fc22c (diff)
downloadmitmproxy-17c65e46cbdcf328dff22acaf4de8704119678ff.tar.gz
mitmproxy-17c65e46cbdcf328dff22acaf4de8704119678ff.tar.bz2
mitmproxy-17c65e46cbdcf328dff22acaf4de8704119678ff.zip
Merge pull request #1480 from mhils/reverse-proxy-auth
Add basic auth support for reverse proxy mode
Diffstat (limited to 'netlib/http')
-rw-r--r--netlib/http/authentication.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/netlib/http/authentication.py b/netlib/http/authentication.py
index 38ea46d6..58fc9bdc 100644
--- a/netlib/http/authentication.py
+++ b/netlib/http/authentication.py
@@ -50,9 +50,9 @@ class NullProxyAuth(object):
return {}
-class BasicProxyAuth(NullProxyAuth):
- CHALLENGE_HEADER = 'Proxy-Authenticate'
- AUTH_HEADER = 'Proxy-Authorization'
+class BasicAuth(NullProxyAuth):
+ CHALLENGE_HEADER = None
+ AUTH_HEADER = None
def __init__(self, password_manager, realm):
NullProxyAuth.__init__(self, password_manager)
@@ -80,6 +80,16 @@ class BasicProxyAuth(NullProxyAuth):
return {self.CHALLENGE_HEADER: 'Basic realm="%s"' % self.realm}
+class BasicWebsiteAuth(BasicAuth):
+ CHALLENGE_HEADER = 'WWW-Authenticate'
+ AUTH_HEADER = 'Authorization'
+
+
+class BasicProxyAuth(BasicAuth):
+ CHALLENGE_HEADER = 'Proxy-Authenticate'
+ AUTH_HEADER = 'Proxy-Authorization'
+
+
class PassMan(object):
def test(self, username_, password_token_):