diff options
author | Thomas Kriechbaumer <Kriechi@users.noreply.github.com> | 2016-08-16 10:07:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-16 10:07:59 +0200 |
commit | 17c65e46cbdcf328dff22acaf4de8704119678ff (patch) | |
tree | fe8ba75b97ab565c6549a3a60e2b9ce0a454da61 /netlib/http/authentication.py | |
parent | f9f0ac848e8a691a78d4458f3d25f21b3e943658 (diff) | |
parent | a9401472cd8002f6e35da8f180400a8b980fc22c (diff) | |
download | mitmproxy-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/authentication.py')
-rw-r--r-- | netlib/http/authentication.py | 16 |
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_): |