Skip to content
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

[DRAFT - Needs more feedback] Add support for user specified token lifetimes #829

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

shreddd
Copy link
Collaborator

@shreddd shreddd commented Dec 10, 2024

In this branch, I updated the /users/token/ endpoint to allow specifying a shorter lifetime to address #828
It enables a new optional parameter to pass in an expires value in seconds, and updates TimeExpires model to include seconds

Details

  • Updated nmdc_runtime/api/core/auth.py to support seconds in TimeExpires and adds support for expires field in form
  • Updated nmdc_runtime/api/endpoints/users.py to support setting access_token lifetime (as long as it is less that ACCESS_TOKEN_EXPIRES default)
  • Added tests in tests/test_api/test_endpoints.py

Related issue(s)

Fixes #828

Related subsystem(s)

  • Runtime API (except the Minter)
  • Minter
  • Dagster
  • Project documentation (in the docs directory)
  • Translators (metadata ingest pipelines)
  • MongoDB migrations
  • Other

Testing

  • I tested these changes (explain below)
  • I did not test these changes

I tested these changes by adding a new test_get_token() test

Documentation

  • I have not checked for relevant documentation yet (e.g. in the docs directory)
  • I have updated all relevant documentation so it will remain accurate
  • Other (explain below)

Swagger docs updated

Maintainability

  • Every Python function I defined includes a docstring (test functions are exempt from this)
  • Every Python function parameter I introduced includes a type hint (e.g. study_id: str)
  • All "to do" or "fix me" Python comments I added begin with either # TODO or # FIXME
  • I used black to format all the Python files I created/modified
  • The PR title is in the imperative mood (e.g. "Do X") and not the declarative mood (e.g. "Does X" or "Did X")

@shreddd shreddd changed the title Add support for user specified token lifetimes [DRAFT - Needs more feedback] Add support for user specified token lifetimes Dec 10, 2024
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.

Add support for shorter lifetimes on tokens
1 participant