Skip to content

Commit 2e7f769

Browse files
authored
Adds auth_provider (#1326)
Issues: Fixes #1325 Problem: auth_provider specification was not available. Therefore, it was not possible to authenticate to a BIG-IQ using different remote auths Analysis: This patch adds that after adding a patch to the f5-icontrol-rest-python repo Tests:
1 parent 12d5f99 commit 2e7f769

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

f5/bigip/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def parse_arguments(self, *args, **kwargs):
5151
timeout=kwargs.pop('timeout', 30),
5252
port=kwargs.pop('port', 443),
5353
icontrol_version=kwargs.pop('icontrol_version', ''),
54-
token=kwargs.pop('token', False)
54+
token=kwargs.pop('token', False),
55+
auth_provider=kwargs.pop('auth_provider', None)
5556
)
5657
if kwargs:
5758
raise TypeError('Unexpected **kwargs: %r' % kwargs)
@@ -63,12 +64,17 @@ def parse_arguments(self, *args, **kwargs):
6364
return result
6465

6566
def _get_icr_session(self, *args, **kwargs):
66-
return iControlRESTSession(
67+
params = dict(
6768
username=kwargs['username'],
6869
password=kwargs['password'],
69-
timeout=kwargs['timeout'],
70-
token=kwargs['token']
70+
timeout=kwargs['timeout']
7171
)
72+
if kwargs['auth_provider']:
73+
params['auth_provider'] = kwargs['auth_provider']
74+
else:
75+
params['token'] = kwargs['token']
76+
result = iControlRESTSession(**params)
77+
return result
7278

7379
def configure_meta_data(self, *args, **kwargs):
7480
self._meta_data = {

f5/bigiq/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ def __init__(self, hostname, username, password, **kwargs):
3131

3232
# The BIG-IQ token is called "local", as opposed to BIG-IP's which
3333
# is called "tmos"
34-
token = kwargs.pop('token', 'local')
34+
auth_provider = kwargs.pop('auth_provider', 'local')
3535
if kwargs:
3636
raise TypeError('Unexpected **kwargs: %r' % kwargs)
3737
# _meta_data variable values
38-
iCRS = iControlRESTSession(username, password, timeout=timeout,
39-
token=token)
38+
iCRS = iControlRESTSession(
39+
username, password, timeout=timeout, auth_provider=auth_provider
40+
)
4041
# define _meta_data
4142
self._meta_data = {
4243
'allowed_lazy_attributes': [Cm, Shared, Tm],

f5/bigiq/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
@pytest.fixture(scope='module')
2121
def mgmt_root(opt_bigip, opt_username, opt_password, opt_port, opt_token):
2222
return ManagementRoot(opt_bigip, opt_username, opt_password,
23-
port=opt_port, token=opt_token)
23+
port=opt_port, auth_provider="local")

f5/bigiq/resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PathElement(BigIpPathElement):
3737

3838
def __init__(self, container):
3939
super(PathElement, self).__init__(container)
40-
self._meta_data['minimum_version'] = '5.0.0'
40+
self._meta_data['minimum_version'] = '5.3.0'
4141

4242

4343
class Resource(BigIpResource, PathElement):

0 commit comments

Comments
 (0)