Skip to content

ENH: Add generate auth token#2

Merged
mferrera merged 1 commit intoequinor:mainfrom
mferrera:add-create-token
Mar 24, 2025
Merged

ENH: Add generate auth token#2
mferrera merged 1 commit intoequinor:mainfrom
mferrera:add-create-token

Conversation

@mferrera
Copy link
Copy Markdown
Collaborator

Resolves #1

Adds a generate token function to pass an authentication token to the API/GUI threads. It also passes it to the React app as URL fragment. Although our security concerns are less severe given we are executing on TGX nodes where users are already authenticated, this adds some additional protection against someone using the same node and navigating to localhost:8000 and hijacking a session. It will also disallow un-authenticated post requests to the API.

Additional this adds some extra tests which were not added when the repository was initialized.

Checklist

  • Tests added (if not, comment why)
  • Test coverage equal or up from main (run pytest with --cov=<packagename> --cov-report term-missing)
  • If not squash merging, every commit passes tests
  • Appropriate commit prefix and precise commit message used
  • All debug prints and unnecessary comments removed
  • Docstrings are correct and updated
  • Documentation is updated, if necessary
  • Latest main rebased/merged into branch
  • Added comments on this PR where appropriate to help reviewers
  • Moved issue status on project board
  • Checked the boxes in this checklist ✅

@mferrera mferrera self-assigned this Mar 21, 2025
Comment on lines +9 to 11
token: str,
host: str = "127.0.0.1",
port: int = 8001,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used yet. This has to be added in the API-exported run_server next.

@mferrera mferrera requested review from joargr and slangeveld March 21, 2025 13:26
@mferrera mferrera force-pushed the add-create-token branch 2 times, most recently from 667a145 to 7480c15 Compare March 22, 2025 05:57
Copy link
Copy Markdown
Collaborator

@slangeveld slangeveld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Copy link
Copy Markdown

@joargr joargr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@mferrera mferrera merged commit d20bc01 into equinor:main Mar 24, 2025
3 checks passed
@mferrera mferrera deleted the add-create-token branch March 24, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate session token on start-up

3 participants