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

Add authentication to /query route #104

Merged
merged 18 commits into from
Jul 14, 2024
Merged

Add authentication to /query route #104

merged 18 commits into from
Jul 14, 2024

Conversation

alyssadai
Copy link
Contributor

@alyssadai alyssadai commented Jul 11, 2024

Changes proposed in this pull request:

  • /query route now expects an authorization token by default
  • added logic to verify token using google-auth
  • added new optional env vars:
    • NB_QUERY_CLIENT_ID: Client ID of query tool
    • NB_ENABLE_AUTH: Whether or not to enable authentication (will determine if client ID is also checked)

Checklist

This section is for the PR reviewer

  • PR has an interpretable title with a prefix ([ENH], [FIX], [REF], [TST], [CI], [MNT], [INF], [MODEL], [DOC]) (see our Contributing Guidelines for more info)
  • PR has a label for the release changelog or skip-release (to be applied by maintainers only)
  • PR links to GitHub issue with mention Closes #XXXX
  • Tests pass
  • Checks pass

For new features:

  • Tests have been added

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

@alyssadai alyssadai added the pr-minor-breaking Feature or enhancement that breaks compatibility, will increment minor version (0.+1.0) label Jul 11, 2024
@coveralls
Copy link
Collaborator

coveralls commented Jul 11, 2024

Pull Request Test Coverage Report for Build 9929726741

Details

  • 80 of 82 (97.56%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 97.043%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/api/security.py 17 18 94.44%
tests/test_security.py 25 26 96.15%
Totals Coverage Status
Change from base Build 9682666455: 0.03%
Covered Lines: 558
Relevant Lines: 575

💛 - Coveralls

@alyssadai alyssadai marked this pull request as ready for review July 11, 2024 21:43
@alyssadai alyssadai requested a review from rmanaem July 12, 2024 16:44
@alyssadai alyssadai removed the request for review from rmanaem July 12, 2024 19:09
Copy link
Contributor

@surchs surchs left a comment

Choose a reason for hiding this comment

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

Awesome, great stuff @alyssadai 🎉. All looks reasonable to me, and good job using trustworthy external libraries for all of this! I left a couple comments - mainly for understanding or clarity.

But good to go as is, just take a quick look and then 🧑‍🍳

app/api/security.py Outdated Show resolved Hide resolved
app/api/security.py Show resolved Hide resolved
tests/test_query.py Outdated Show resolved Hide resolved
tests/test_query.py Show resolved Hide resolved
tests/test_query.py Show resolved Hide resolved
tests/test_security.py Show resolved Hide resolved
tests/test_security.py Show resolved Hide resolved
tests/test_security.py Outdated Show resolved Hide resolved
tests/test_security.py Outdated Show resolved Hide resolved
tests/test_security.py Outdated Show resolved Hide resolved
alyssadai and others added 3 commits July 14, 2024 13:47
@alyssadai alyssadai merged commit 16f3f42 into main Jul 14, 2024
5 checks passed
@alyssadai alyssadai deleted the add-oauth branch July 14, 2024 18:14
@neurobagel-bot
Copy link

neurobagel-bot bot commented Aug 2, 2024

🚀 PR was released in v0.3.0 🚀

@neurobagel-bot neurobagel-bot bot added the released This issue/pull request has been released. label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-minor-breaking Feature or enhancement that breaks compatibility, will increment minor version (0.+1.0) released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify ID token passed in through header
3 participants