Skip to content

Commit

Permalink
Fix authentication configuration (#17)
Browse files Browse the repository at this point in the history
* Fix authentication configuration

This commit fixes some issues that were caught when running with newer
versions of pyjwt around handling the authentication tokens.

* Add websockets to pylint ignore module list

Co-authored-by: dlucchetti <66442351+dlucchetti@users.noreply.github.com>
  • Loading branch information
mtreinish and dlucchetti authored May 21, 2021
1 parent b79deb3 commit d9c15a0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ ignore-mixin-members=yes
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=matplotlib.cm,numpy.random,retworkx,qiskit.providers
ignored-modules=matplotlib.cm,numpy.random,retworkx,qiskit.providers,websockets

# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/honeywell/credentials/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def _login(self) -> str:
id_token = self._get_token('id_token')

# check id_token is not expired yet
expiration_date = jwt.decode(id_token, verify=False)['exp']
expiration_date = jwt.decode(id_token, verify=False, algorithms=["RS256"])['exp']
if expiration_date < (datetime.datetime.now(datetime.timezone.utc).timestamp()):
print("Your id token is expired. Refreshing...")

Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/honeywell/honeywelljob.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def __init__(self, backend, job_id, api=None, qobj=None):
self._job_ids = []
self._experiment_results = []

self._qobj_payload = {}
if qobj:
validate_qobj_against_schema(qobj)
self._qobj_payload = qobj.to_dict()
Expand All @@ -166,7 +167,6 @@ def __init__(self, backend, job_id, api=None, qobj=None):
self._experiments, self._qobj_config, _ = disassemble(qobj)
self._status = JobStatus.INITIALIZING
else:
self._qobj_payload = {}
self._status = JobStatus.INITIALIZING
self._job_ids.append(job_id)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ nest-asyncio>=1.2.0
qiskit-terra>=0.10
requests>=2.19
websockets>=7
pyjwt>=1.7.1
pyjwt>=1.7.1,<2
keyring>=10.6.0
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
'nest-asyncio>=1.2.0',
'qiskit-terra>=0.10',
'requests>=2.19',
'websockets>=7'
'websockets>=7',
'pyjwt>=1.7.1,<2',
'keyring>=10.6.0',
]

version_path = os.path.abspath(os.path.join(
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ deps =
pycodestyle
pylint
setuptools>=40.1.0
pyjwt>=1.7.1
pyjwt>=1.7.1,<2
keyring>=10.6.0
commands =
pycodestyle qiskit/providers/honeywell test/
Expand Down

0 comments on commit d9c15a0

Please sign in to comment.