oscar-python 1.1.0b1__tar.gz → 1.1.0b3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/PKG-INFO +1 -1
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/_utils.py +3 -1
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/client.py +17 -10
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python.egg-info/PKG-INFO +1 -1
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/LICENSE +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/README.md +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/__init__.py +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/_providers/_minio.py +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/_providers/_onedata.py +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/_providers/_providers_base.py +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/_providers/_s3.py +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/_providers/_webdav.py +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/local_test.py +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python/storage.py +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python.egg-info/SOURCES.txt +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python.egg-info/dependency_links.txt +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python.egg-info/not-zip-safe +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python.egg-info/requires.txt +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/oscar_python.egg-info/top_level.txt +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/setup.cfg +0 -0
- {oscar_python-1.1.0b1 → oscar_python-1.1.0b3}/setup.py +0 -0
|
@@ -48,9 +48,11 @@ def get_headers(c):
|
|
|
48
48
|
usr_pass_as_bytes = bytes(c.user+":"+c.password,"utf-8")
|
|
49
49
|
usr_pass_base_64 = base64.b64encode(usr_pass_as_bytes).decode("utf-8")
|
|
50
50
|
return {"Authorization": "Basic "+ usr_pass_base_64}
|
|
51
|
-
if c._AUTH_TYPE == "oidc":
|
|
51
|
+
if c._AUTH_TYPE == "oidc-agent":
|
|
52
52
|
token = agent.get_access_token(c.shortname)
|
|
53
53
|
return get_headers_with_token(token)
|
|
54
|
+
if c._AUTH_TYPE == "oidc":
|
|
55
|
+
return get_headers_with_token(c.oidc_token)
|
|
54
56
|
|
|
55
57
|
""" Function to generate headers with token auth """
|
|
56
58
|
def get_headers_with_token(token):
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
import json
|
|
17
17
|
import yaml
|
|
18
18
|
import liboidcagent as agent
|
|
19
|
-
import oscar_python._utils as utils
|
|
19
|
+
#import oscar_python._utils as utils
|
|
20
|
+
import _utils as utils
|
|
20
21
|
from oscar_python.storage import Storage
|
|
21
22
|
|
|
22
23
|
_INFO_PATH = "/system/info"
|
|
@@ -38,35 +39,41 @@ class Client:
|
|
|
38
39
|
self.set_auth_type(options)
|
|
39
40
|
if self._AUTH_TYPE == 'basicauth':
|
|
40
41
|
self.basic_auth_client(options)
|
|
42
|
+
if self._AUTH_TYPE == 'oidc-agent':
|
|
43
|
+
self.oidc_agent_client(options)
|
|
41
44
|
if self._AUTH_TYPE == 'oidc':
|
|
42
45
|
self.oidc_client(options)
|
|
43
46
|
|
|
44
47
|
def basic_auth_client(self, options):
|
|
45
|
-
self.id =
|
|
48
|
+
self.id = options['cluster_id']
|
|
46
49
|
self.endpoint = options['endpoint']
|
|
47
50
|
self.user = options['user']
|
|
48
51
|
self.password = options['password']
|
|
49
52
|
self.ssl = bool(options['ssl'])
|
|
50
53
|
|
|
51
|
-
def
|
|
52
|
-
self.id =
|
|
54
|
+
def oidc_agent_client(self, options):
|
|
55
|
+
self.id = options['cluster_id']
|
|
53
56
|
self.endpoint = options['endpoint']
|
|
54
57
|
self.shortname = options['shortname']
|
|
55
58
|
self.ssl = bool(options['ssl'])
|
|
59
|
+
|
|
60
|
+
def oidc_client(self, options):
|
|
61
|
+
self.id = options['cluster_id']
|
|
62
|
+
self.endpoint = options['endpoint']
|
|
63
|
+
self.oidc_token = options['oidc_token']
|
|
64
|
+
self.ssl = bool(options['ssl'])
|
|
56
65
|
|
|
57
66
|
def set_auth_type(self, options):
|
|
58
67
|
if 'user' in options:
|
|
59
68
|
self._AUTH_TYPE = "basicauth"
|
|
60
|
-
try:
|
|
61
|
-
self.get_cluster_info()
|
|
62
|
-
except:
|
|
63
|
-
print("")
|
|
64
69
|
elif 'shortname' in options:
|
|
65
|
-
self._AUTH_TYPE = "oidc"
|
|
70
|
+
self._AUTH_TYPE = "oidc-agent"
|
|
66
71
|
try:
|
|
67
|
-
agent.get_access_token(
|
|
72
|
+
agent.get_access_token(options['shortname'])
|
|
68
73
|
except agent.OidcAgentError as e:
|
|
69
74
|
print("ERROR oidc-agent: {}".format(e))
|
|
75
|
+
elif 'oidc_token' in options:
|
|
76
|
+
self._AUTH_TYPE == "oidc"
|
|
70
77
|
else:
|
|
71
78
|
raise ValueError("Unrecognized authentication credentials in options")
|
|
72
79
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|