forked from jpwhite4/xdmod-python
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to authenticate with a JWT loaded from a file. #54
Draft
aaronweeden
wants to merge
13
commits into
ubccr:v1.x.y
Choose a base branch
from
aaronweeden:load-jwt-file
base: v1.x.y
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4d8ac88
to
14a969b
Compare
dc38b80
to
01c9836
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR, along with an upcoming PR to
xdmod
, makes it possible forxdmod-data
to authenticate to the XDMoD REST API via a JSON Web Token (JWT) loaded from a file. This is needed to support XDMoD being connected to a JupyterHub. The JupyterHub will periodically write temporary JWTs to the file~/.xdmod-jwt.env
; the changes in this PR make it so that every time a request is made byxdmod-data
to the XDMoD REST API, that file is read and the token is added as a headerAuthentication: Bearer <JWT>
to the request.The current method of instead setting an
XDMOD_API_TOKEN
environment variable is still needed since users connecting outside of a JupyterHub will still be supported. This PR makes it so that if that environment variable is defined when theDataWarehouse
is constructed, it will use that token in the request headers instead of the JWT from the file. This also supports the ability in the JupyterHub setup to interface with multiple XDMoD portals from the same notebook, as in the following:Tests performed
Type of change:
Checklist:
CHANGELOG.md
has been updatedxdmod_data/__version__.py
has been updated to the next development versionxdmod-notebooks
repository as necessary, and the notebooks all run successfully