Skip to content

Commit

Permalink
Merge pull request #4 from OneIdentity/PAM-11154-http-proxy-traceback
Browse files Browse the repository at this point in the history
Pam 11154 http proxy traceback
  • Loading branch information
tobal committed Nov 4, 2019
2 parents 45b93dd + 585295b commit 22e4329
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2.0.3 2019-11-04

Bugfix, check http proxy settings before getting them.

2.0.2 2019-07-01

Use common HTTPS proxy settings. Add proxy basic authentication capability.
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
api: 1.2
type: aa
name: SPS_Duo
version: 2.0.2
version: 2.0.3
description: Duo Multi-Factor Authentication plugin
entry_point: main.py
4 changes: 3 additions & 1 deletion lib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def __init__(self, ikey, skey, host, timeout=30, ignore_connection_error=False,
logger.info('Client initialized.')

def _set_http_proxy_settings(self, http_proxy_settings):
if not http_proxy_settings:
if (not http_proxy_settings
or not http_proxy_settings.get('server')
or not http_proxy_settings.get('port')):
return
if http_proxy_settings.get('username') and http_proxy_settings.get('password'):
# rfc7617 The 'Basic' HTTP Authentication Scheme
Expand Down
12 changes: 12 additions & 0 deletions lib/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ def test_duo_set_proxy():
assert client._duo.proxy_port == 3128


def test_duo_proxy_is_not_set_when_settings_omitted():
client = Client('ikey', 'skey', 'host', http_proxy_settings=None)
assert client._duo.proxy_host is None
assert client._duo.proxy_port is None


def test_duo_proxy_is_not_set_when_proxy_settings_not_set():
client = Client('ikey', 'skey', 'host', http_proxy_settings=dict(username='u', password='p'))
assert client._duo.proxy_host is None
assert client._duo.proxy_port is None


def test_duo_set_proxy_auth():
client = Client(
'ikey', 'skey', 'host', http_proxy_settings=dict(server='proxy', port='3128', username='u', password='p')
Expand Down

0 comments on commit 22e4329

Please sign in to comment.