From 4d77db03916424477e0d4c14c6dec8cd14d1e56b Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 13:06:01 +0200 Subject: [PATCH 01/15] Create python-publish.yml --- .github/workflows/python-publish.yml | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..4e1ef42 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,31 @@ +# This workflows will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* From b2b172ab7f2315cbbe4ad80d529d1737d3ca455e Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 13:08:42 +0200 Subject: [PATCH 02/15] import urlparse for python3 --- oktaauth/metadata.py | 2 +- oktaauth/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oktaauth/metadata.py b/oktaauth/metadata.py index 0a82dbc..909e080 100644 --- a/oktaauth/metadata.py +++ b/oktaauth/metadata.py @@ -8,7 +8,7 @@ package = 'oktaauth' project = "Okta CLI authentication" project_no_spaces = project.replace(' ', '') -version = '0.2' +version = '0.3' description = 'Authenticates from the CLI' authors = ['Peter Gillard-Moss'] authors_string = ', '.join(authors) diff --git a/oktaauth/models.py b/oktaauth/models.py index 3153ff2..27e48d5 100644 --- a/oktaauth/models.py +++ b/oktaauth/models.py @@ -1,6 +1,6 @@ import requests import base64 -import urlparse +from urllib.parse import urlparse import logging from bs4 import BeautifulSoup log = logging.getLogger('oktaauth') From 1628ca10ba931c22186f0c8ab4b8bc988670b469 Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 13:29:30 +0200 Subject: [PATCH 03/15] rename the package to oktaauth-py3 --- README.rst | 8 ++++---- docs/source/README | 6 +++--- docs/source/conf.py | 2 +- {oktaauth => oktaauth-py3}/__init__.py | 0 {oktaauth => oktaauth-py3}/main.py | 6 +++--- {oktaauth => oktaauth-py3}/metadata.py | 2 +- {oktaauth => oktaauth-py3}/models.py | 2 +- pavement.py | 2 +- setup.py | 6 +++--- tests/test_main.py | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) rename {oktaauth => oktaauth-py3}/__init__.py (100%) rename {oktaauth => oktaauth-py3}/main.py (95%) rename {oktaauth => oktaauth-py3}/metadata.py (95%) rename {oktaauth => oktaauth-py3}/models.py (99%) diff --git a/README.rst b/README.rst index 27bc700..8d6d57c 100644 --- a/README.rst +++ b/README.rst @@ -1,19 +1,19 @@ ========================= - oktaauth + oktaauth-py3 ========================= -The oktaauth module and command line interface allows users to +The oktaauth-py3 module and command line interface allows users to authenticate with Okta and obtain a SAML assertion either from the command line or programmatically from another script. Usage ===== -The oktaauth CLI requires a few arguments to operate. +The oktaauth-py3 CLI requires a few arguments to operate. # obtain a SAML response from Okta - $ oktaauth --username joebloggs --server + $ oktaauth-py3 --username joebloggs --server acemeinc.okta.com --apptype amazon_aws --appid exk5c0llc The *apptype* and *appid* are provided by okta and would be seen in the diff --git a/docs/source/README b/docs/source/README index 10dcb2d..0061113 100644 --- a/docs/source/README +++ b/docs/source/README @@ -1,5 +1,5 @@ -Run `sphinx-apidoc -o . ../../oktaauth' in this directory. +Run `sphinx-apidoc -o . ../../oktaauth-py3' in this directory. -This will generate `modules.rst' and `oktaauth.rst'. +This will generate `modules.rst' and `oktaauth-py3.rst'. -Then include `modules.rst' in your `index.rst' file. \ No newline at end of file +Then include `modules.rst' in your `index.rst' file. diff --git a/docs/source/conf.py b/docs/source/conf.py index a561a1b..2a652fd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,7 +22,7 @@ sys.path.insert(0, os.path.abspath('../..')) # Import project metadata -from oktaauth import metadata +from oktaauth-py3 import metadata # -- General configuration ---------------------------------------------------- diff --git a/oktaauth/__init__.py b/oktaauth-py3/__init__.py similarity index 100% rename from oktaauth/__init__.py rename to oktaauth-py3/__init__.py diff --git a/oktaauth/main.py b/oktaauth-py3/main.py similarity index 95% rename from oktaauth/main.py rename to oktaauth-py3/main.py index 1a719ed..53f7684 100755 --- a/oktaauth/main.py +++ b/oktaauth-py3/main.py @@ -9,10 +9,10 @@ import getpass import logging -from oktaauth import models -from oktaauth import metadata +from oktaauth-py3 import models +from oktaauth-py3 import metadata -log = logging.getLogger('oktaauth') +log = logging.getLogger('oktaauth-py3') def configurelogging(): log.setLevel(logging.DEBUG) diff --git a/oktaauth/metadata.py b/oktaauth-py3/metadata.py similarity index 95% rename from oktaauth/metadata.py rename to oktaauth-py3/metadata.py index 909e080..c864846 100644 --- a/oktaauth/metadata.py +++ b/oktaauth-py3/metadata.py @@ -5,7 +5,7 @@ """ # The package name, which is also the "UNIX name" for the project. -package = 'oktaauth' +package = 'oktaauth-py3' project = "Okta CLI authentication" project_no_spaces = project.replace(' ', '') version = '0.3' diff --git a/oktaauth/models.py b/oktaauth-py3/models.py similarity index 99% rename from oktaauth/models.py rename to oktaauth-py3/models.py index 27e48d5..e91c840 100644 --- a/oktaauth/models.py +++ b/oktaauth-py3/models.py @@ -3,7 +3,7 @@ from urllib.parse import urlparse import logging from bs4 import BeautifulSoup -log = logging.getLogger('oktaauth') +log = logging.getLogger('oktaauth-py3') class OktaAPIAuth(object): diff --git a/pavement.py b/pavement.py index 7830305..3195492 100644 --- a/pavement.py +++ b/pavement.py @@ -129,7 +129,7 @@ def run(args): # executable. So we just pass the package name in as the executable name, # since it's close enough. This should never be seen by an end user # installing through Setuptools anyway. - from oktaauth.main import main + from oktaauth-py3.main import main raise SystemExit(main([CODE_DIRECTORY] + args)) diff --git a/setup.py b/setup.py index ab373af..d77ca9e 100644 --- a/setup.py +++ b/setup.py @@ -35,14 +35,14 @@ def check_output(cmd_args, *args, **kwargs): sys.path.insert(0, os.path.abspath('.')) ## Constants -CODE_DIRECTORY = 'oktaauth' +CODE_DIRECTORY = 'oktaauth-py3' DOCS_DIRECTORY = 'docs' TESTS_DIRECTORY = 'tests' PYTEST_FLAGS = ['--doctest-modules'] # Import metadata. Normally this would just be: # -# from oktaauth import metadata +# from oktaauth-py3 import metadata # # However, when we do this, we also import `oktaauth/__init__.py'. If this # imports names from some other modules and these modules have third-party @@ -268,7 +268,7 @@ def run_tests(self): zip_safe=False, # don't use eggs entry_points={ 'console_scripts': [ - 'oktaauth = oktaauth.main:entry_point' + 'oktaauth-py3 = oktaauth-py3.main:entry_point' ] } ) diff --git a/tests/test_main.py b/tests/test_main.py index d334440..31f095a 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -8,8 +8,8 @@ import pytest parametrize = pytest.mark.parametrize -from oktaauth import metadata -from oktaauth.main import main +from oktaauth-py3 import metadata +from oktaauth-py3.main import main class TestMain(object): From 2be617a7e712215872fdb14e5fe52bb0c3861849 Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 13:33:50 +0200 Subject: [PATCH 04/15] reset version --- oktaauth-py3/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oktaauth-py3/metadata.py b/oktaauth-py3/metadata.py index c864846..5b5ab53 100644 --- a/oktaauth-py3/metadata.py +++ b/oktaauth-py3/metadata.py @@ -8,7 +8,7 @@ package = 'oktaauth-py3' project = "Okta CLI authentication" project_no_spaces = project.replace(' ', '') -version = '0.3' +version = '0.1' description = 'Authenticates from the CLI' authors = ['Peter Gillard-Moss'] authors_string = ', '.join(authors) From df9b26b4f12cf23fc39bf837743b9271b0c388cc Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 13:42:58 +0200 Subject: [PATCH 05/15] rename the package --- README.rst | 8 ++++---- docs/source/README | 4 ++-- docs/source/conf.py | 2 +- {oktaauth-py3 => oktaauthpy3}/__init__.py | 0 {oktaauth-py3 => oktaauthpy3}/main.py | 6 +++--- {oktaauth-py3 => oktaauthpy3}/metadata.py | 2 +- {oktaauth-py3 => oktaauthpy3}/models.py | 2 +- pavement.py | 2 +- setup.py | 8 ++++---- tests/test_main.py | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) rename {oktaauth-py3 => oktaauthpy3}/__init__.py (100%) rename {oktaauth-py3 => oktaauthpy3}/main.py (95%) rename {oktaauth-py3 => oktaauthpy3}/metadata.py (95%) rename {oktaauth-py3 => oktaauthpy3}/models.py (99%) diff --git a/README.rst b/README.rst index 8d6d57c..1ae95c9 100644 --- a/README.rst +++ b/README.rst @@ -1,19 +1,19 @@ ========================= - oktaauth-py3 + oktaauthpy3 ========================= -The oktaauth-py3 module and command line interface allows users to +The oktaauthpy3 module and command line interface allows users to authenticate with Okta and obtain a SAML assertion either from the command line or programmatically from another script. Usage ===== -The oktaauth-py3 CLI requires a few arguments to operate. +The oktaauthpy3 CLI requires a few arguments to operate. # obtain a SAML response from Okta - $ oktaauth-py3 --username joebloggs --server + $ oktaauthpy3 --username joebloggs --server acemeinc.okta.com --apptype amazon_aws --appid exk5c0llc The *apptype* and *appid* are provided by okta and would be seen in the diff --git a/docs/source/README b/docs/source/README index 0061113..2f11dea 100644 --- a/docs/source/README +++ b/docs/source/README @@ -1,5 +1,5 @@ -Run `sphinx-apidoc -o . ../../oktaauth-py3' in this directory. +Run `sphinx-apidoc -o . ../../oktaauthpy3' in this directory. -This will generate `modules.rst' and `oktaauth-py3.rst'. +This will generate `modules.rst' and `oktaauthpy3.rst'. Then include `modules.rst' in your `index.rst' file. diff --git a/docs/source/conf.py b/docs/source/conf.py index 2a652fd..d3391fe 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,7 +22,7 @@ sys.path.insert(0, os.path.abspath('../..')) # Import project metadata -from oktaauth-py3 import metadata +from oktaauthpy3 import metadata # -- General configuration ---------------------------------------------------- diff --git a/oktaauth-py3/__init__.py b/oktaauthpy3/__init__.py similarity index 100% rename from oktaauth-py3/__init__.py rename to oktaauthpy3/__init__.py diff --git a/oktaauth-py3/main.py b/oktaauthpy3/main.py similarity index 95% rename from oktaauth-py3/main.py rename to oktaauthpy3/main.py index 53f7684..2392f79 100755 --- a/oktaauth-py3/main.py +++ b/oktaauthpy3/main.py @@ -9,10 +9,10 @@ import getpass import logging -from oktaauth-py3 import models -from oktaauth-py3 import metadata +from oktaauthpy3 import models +from oktaauthpy3 import metadata -log = logging.getLogger('oktaauth-py3') +log = logging.getLogger('oktaauthpy3') def configurelogging(): log.setLevel(logging.DEBUG) diff --git a/oktaauth-py3/metadata.py b/oktaauthpy3/metadata.py similarity index 95% rename from oktaauth-py3/metadata.py rename to oktaauthpy3/metadata.py index 5b5ab53..df760c1 100644 --- a/oktaauth-py3/metadata.py +++ b/oktaauthpy3/metadata.py @@ -5,7 +5,7 @@ """ # The package name, which is also the "UNIX name" for the project. -package = 'oktaauth-py3' +package = 'oktaauthpy3' project = "Okta CLI authentication" project_no_spaces = project.replace(' ', '') version = '0.1' diff --git a/oktaauth-py3/models.py b/oktaauthpy3/models.py similarity index 99% rename from oktaauth-py3/models.py rename to oktaauthpy3/models.py index e91c840..b5a585d 100644 --- a/oktaauth-py3/models.py +++ b/oktaauthpy3/models.py @@ -3,7 +3,7 @@ from urllib.parse import urlparse import logging from bs4 import BeautifulSoup -log = logging.getLogger('oktaauth-py3') +log = logging.getLogger('oktaauthpy3') class OktaAPIAuth(object): diff --git a/pavement.py b/pavement.py index 3195492..c7135d4 100644 --- a/pavement.py +++ b/pavement.py @@ -129,7 +129,7 @@ def run(args): # executable. So we just pass the package name in as the executable name, # since it's close enough. This should never be seen by an end user # installing through Setuptools anyway. - from oktaauth-py3.main import main + from oktaauthpy3.main import main raise SystemExit(main([CODE_DIRECTORY] + args)) diff --git a/setup.py b/setup.py index d77ca9e..12674af 100644 --- a/setup.py +++ b/setup.py @@ -35,16 +35,16 @@ def check_output(cmd_args, *args, **kwargs): sys.path.insert(0, os.path.abspath('.')) ## Constants -CODE_DIRECTORY = 'oktaauth-py3' +CODE_DIRECTORY = 'oktaauthpy3' DOCS_DIRECTORY = 'docs' TESTS_DIRECTORY = 'tests' PYTEST_FLAGS = ['--doctest-modules'] # Import metadata. Normally this would just be: # -# from oktaauth-py3 import metadata +# from oktaauthpy3 import metadata # -# However, when we do this, we also import `oktaauth/__init__.py'. If this +# However, when we do this, we also import `oktaauthpy3/__init__.py'. If this # imports names from some other modules and these modules have third-party # dependencies that need installing (which happens after this file is run), the # script will crash. What we do instead is to load the metadata module by path @@ -268,7 +268,7 @@ def run_tests(self): zip_safe=False, # don't use eggs entry_points={ 'console_scripts': [ - 'oktaauth-py3 = oktaauth-py3.main:entry_point' + 'oktaauthpy3 = oktaauthpy3.main:entry_point' ] } ) diff --git a/tests/test_main.py b/tests/test_main.py index 31f095a..fa20ff1 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -8,8 +8,8 @@ import pytest parametrize = pytest.mark.parametrize -from oktaauth-py3 import metadata -from oktaauth-py3.main import main +from oktaauthpy3 import metadata +from oktaauthpy3.main import main class TestMain(object): From b6fc4ddbfd4ca89b10cec7ca504e895630305a81 Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 14:06:58 +0200 Subject: [PATCH 06/15] update readme --- README.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 1ae95c9..7a02d3d 100644 --- a/README.rst +++ b/README.rst @@ -2,6 +2,8 @@ oktaauthpy3 ========================= +This is a fork of oktaauth with Python3 support + The oktaauthpy3 module and command line interface allows users to authenticate with Okta and obtain a SAML assertion either from the command line or programmatically from another script. @@ -27,11 +29,15 @@ submit a pull request to this ``README``. Thanks ====== +Peter Gillard-Moss who is the original Author or oktaauth +https://pypi.org/project/oktaauth/ + Thanks to Okta for help. I borrowed a lot of code from https://github.com/okta/okta-openvpn to handle the Okta API authentication flow. -Authors -======= -* Peter Gillard-Moss +Author +=========== + +* Mansab Uppal From f98475665f556657792d9d74527c23f3f55249bf Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 14:09:53 +0200 Subject: [PATCH 07/15] update release version --- oktaauthpy3/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oktaauthpy3/metadata.py b/oktaauthpy3/metadata.py index df760c1..767fdef 100644 --- a/oktaauthpy3/metadata.py +++ b/oktaauthpy3/metadata.py @@ -8,7 +8,7 @@ package = 'oktaauthpy3' project = "Okta CLI authentication" project_no_spaces = project.replace(' ', '') -version = '0.1' +version = '0.2' description = 'Authenticates from the CLI' authors = ['Peter Gillard-Moss'] authors_string = ', '.join(authors) From 87bef2bd55d74416b1e72b4c8b4e7dee89b39bd4 Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 14:19:58 +0200 Subject: [PATCH 08/15] Fix module import --- oktaauthpy3/__init__.py | 2 +- oktaauthpy3/metadata.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oktaauthpy3/__init__.py b/oktaauthpy3/__init__.py index d356ee2..a8b61c6 100644 --- a/oktaauthpy3/__init__.py +++ b/oktaauthpy3/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Authenticates from the CLI""" -from oktaauth import metadata +from oktaauthpy3 import metadata __version__ = metadata.version diff --git a/oktaauthpy3/metadata.py b/oktaauthpy3/metadata.py index 767fdef..17368c2 100644 --- a/oktaauthpy3/metadata.py +++ b/oktaauthpy3/metadata.py @@ -8,7 +8,7 @@ package = 'oktaauthpy3' project = "Okta CLI authentication" project_no_spaces = project.replace(' ', '') -version = '0.2' +version = '0.3' description = 'Authenticates from the CLI' authors = ['Peter Gillard-Moss'] authors_string = ', '.join(authors) From 149a9a0e2e849ab04dcc43afa3b8a23e9e956fa0 Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 17:18:14 +0200 Subject: [PATCH 09/15] import urlunparse and use it --- oktaauthpy3/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oktaauthpy3/models.py b/oktaauthpy3/models.py index b5a585d..3b43e97 100644 --- a/oktaauthpy3/models.py +++ b/oktaauthpy3/models.py @@ -1,6 +1,7 @@ import requests import base64 from urllib.parse import urlparse +from urllib.parse import urlunparse import logging from bs4 import BeautifulSoup log = logging.getLogger('oktaauthpy3') @@ -15,7 +16,7 @@ def __init__(self, okta_server, username, password, passcode): self.passcode = passcode url_new = ('https', okta_server, '', '', '','') - self.okta_url = urlparse.urlunparse(url_new) + self.okta_url = urlunparse(url_new) return def okta_req(self, path, data): From 169edbb6e3dea95fc827844a69d0571fdf09b2aa Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 17:22:37 +0200 Subject: [PATCH 10/15] release a new version --- oktaauthpy3/metadata.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oktaauthpy3/metadata.py b/oktaauthpy3/metadata.py index 17368c2..a7f5f40 100644 --- a/oktaauthpy3/metadata.py +++ b/oktaauthpy3/metadata.py @@ -6,13 +6,15 @@ # The package name, which is also the "UNIX name" for the project. package = 'oktaauthpy3' -project = "Okta CLI authentication" +project = "Okta CLI authentication with Python3 support" project_no_spaces = project.replace(' ', '') -version = '0.3' +version = '0.4' description = 'Authenticates from the CLI' authors = ['Peter Gillard-Moss'] authors_string = ', '.join(authors) -emails = ['pgillard@thoughtworks.com'] +maintainers = ['Mansab Uppal'] +maintainers_string = ', '.join(maintainers) +emails = ['muppal@thoughtworks.com'] license = 'Apache 2.0' copyright = '2015 Thoughtworks Inc' url = 'https://www.thoughtworks.com/' From 54892e1ad8d3933dd183cdc7f9086fbb8835a7ee Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 17:49:26 +0200 Subject: [PATCH 11/15] response is str and decoding is not required in py 3 --- oktaauthpy3/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oktaauthpy3/models.py b/oktaauthpy3/models.py index 3b43e97..05c41cc 100644 --- a/oktaauthpy3/models.py +++ b/oktaauthpy3/models.py @@ -110,7 +110,7 @@ def saml(self, sessionToken): if resp.status_code != 200: raise Exception('Received error code from server: %s' % resp.status_code) - return resp.text.decode('utf8') + return resp.text def assertion(self, saml): assertion = '' From 104f56a50551adeb5dae3f21b43398a9f431641f Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 17:49:26 +0200 Subject: [PATCH 12/15] response is str, decoding not required in python3 --- oktaauthpy3/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oktaauthpy3/metadata.py b/oktaauthpy3/metadata.py index a7f5f40..09c5b22 100644 --- a/oktaauthpy3/metadata.py +++ b/oktaauthpy3/metadata.py @@ -8,7 +8,7 @@ package = 'oktaauthpy3' project = "Okta CLI authentication with Python3 support" project_no_spaces = project.replace(' ', '') -version = '0.4' +version = '0.5' description = 'Authenticates from the CLI' authors = ['Peter Gillard-Moss'] authors_string = ', '.join(authors) From 9dad0e7febb4989e182a0d3ce5cd4a9dd664746a Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 17:59:40 +0200 Subject: [PATCH 13/15] return str reponse, bump version --- oktaauthpy3/metadata.py | 2 +- oktaauthpy3/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oktaauthpy3/metadata.py b/oktaauthpy3/metadata.py index 09c5b22..bcaeaf1 100644 --- a/oktaauthpy3/metadata.py +++ b/oktaauthpy3/metadata.py @@ -8,7 +8,7 @@ package = 'oktaauthpy3' project = "Okta CLI authentication with Python3 support" project_no_spaces = project.replace(' ', '') -version = '0.5' +version = '0.6' description = 'Authenticates from the CLI' authors = ['Peter Gillard-Moss'] authors_string = ', '.join(authors) diff --git a/oktaauthpy3/models.py b/oktaauthpy3/models.py index 05c41cc..3b426e7 100644 --- a/oktaauthpy3/models.py +++ b/oktaauthpy3/models.py @@ -110,7 +110,7 @@ def saml(self, sessionToken): if resp.status_code != 200: raise Exception('Received error code from server: %s' % resp.status_code) - return resp.text + return resp.str def assertion(self, saml): assertion = '' From 6aafb2d6efdab507982a6b85146c99e040b588af Mon Sep 17 00:00:00 2001 From: Mansab Uppal Date: Thu, 11 Jun 2020 22:36:30 +0200 Subject: [PATCH 14/15] Response is object --- oktaauthpy3/metadata.py | 2 +- oktaauthpy3/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oktaauthpy3/metadata.py b/oktaauthpy3/metadata.py index bcaeaf1..f793727 100644 --- a/oktaauthpy3/metadata.py +++ b/oktaauthpy3/metadata.py @@ -8,7 +8,7 @@ package = 'oktaauthpy3' project = "Okta CLI authentication with Python3 support" project_no_spaces = project.replace(' ', '') -version = '0.6' +version = '0.7' description = 'Authenticates from the CLI' authors = ['Peter Gillard-Moss'] authors_string = ', '.join(authors) diff --git a/oktaauthpy3/models.py b/oktaauthpy3/models.py index 3b426e7..05c41cc 100644 --- a/oktaauthpy3/models.py +++ b/oktaauthpy3/models.py @@ -110,7 +110,7 @@ def saml(self, sessionToken): if resp.status_code != 200: raise Exception('Received error code from server: %s' % resp.status_code) - return resp.str + return resp.text def assertion(self, saml): assertion = '' From dfe0c15cbf17944ab1de97fbefea4a9b9e03f00f Mon Sep 17 00:00:00 2001 From: Mauro Vilasi Date: Sat, 7 Nov 2020 13:01:54 +0000 Subject: [PATCH 15/15] Convert xml output to 'utf-8' --- oktaauthpy3/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oktaauthpy3/models.py b/oktaauthpy3/models.py index 05c41cc..f87df43 100644 --- a/oktaauthpy3/models.py +++ b/oktaauthpy3/models.py @@ -119,7 +119,8 @@ def assertion(self, saml): if inputtag.get('name') == 'SAMLResponse': assertion = inputtag.get('value') - return base64.b64decode(assertion) + decodedAssertion = base64.b64decode(assertion) + return str(decodedAssertion, "utf-8") def auth(self): token = super(OktaSamlAuth, self).auth()