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

REST API cookie authentication and refactor #250

Merged
merged 98 commits into from
Aug 24, 2022
Merged

Conversation

haasal
Copy link
Contributor

@haasal haasal commented May 30, 2022

Changes

The authentication method was changed to cookie authentication with jwt tokens.
The login router was completly changed and moved to /user.

OAuth scopes are included in the jwt token but scopes aren't implemented yet. This is why the check_authorization function was commented out instead of beeing removed. This is also why some unused imports aren't cleaned up yet.

I removed the secret key from the service class and moved it into the Settings class for the fastapi jwt package.
I also did some minor cleanup.

Reasoning

The package was used to increase security, decrease complexity and for ease of use.

The key is generated at runtime to decrease the security risk of accidently publishing it with the config file, decreasing the it's lifespan and enabling the possibilty to regenerate it during runtime in the future.

TODO

  • Authorization/scopes (if needed)
  • Reenabling csrf tokens and secure cookies in Settings class
  • Writing/adjusting tests

@haasal haasal requested review from giffels, maxfischer2781 and a team May 30, 2022 14:49
@lgtm-com
Copy link

lgtm-com bot commented May 30, 2022

This pull request introduces 7 alerts when merging c43aceb into d45425a - view on LGTM.com

new alerts:

  • 7 for Unused import

Copy link
Member

@giffels giffels left a comment

Choose a reason for hiding this comment

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

I would request only few minor modifications, before approval. Please, see inline comments. In addition, could you please remove drone_registry.db-shm and drone_registry.db-wal from the repe?

tardis/rest/app/routers/resources.py Outdated Show resolved Hide resolved
tardis/rest/app/routers/types.py Outdated Show resolved Hide resolved
tests/rest_t/app_t/test_security.py Outdated Show resolved Hide resolved
tests/rest_t/routers_t/test_resources.py Show resolved Hide resolved
giffels
giffels previously approved these changes Aug 23, 2022
Copy link
Member

@giffels giffels left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your work. This is now ready to merge.

Copy link
Member

@mschnepf mschnepf 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 just two open points, see review.

tests/rest_t/app_t/test_security.py Outdated Show resolved Hide resolved
tardis/rest/app/routers/resources.py Show resolved Hide resolved
Copy link
Member

@mschnepf mschnepf 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. Thanks you very much for all your work. 👍

Copy link
Member

@giffels giffels left a comment

Choose a reason for hiding this comment

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

Good to go!

@giffels giffels merged commit cc13dfd into MatterMiners:master Aug 24, 2022
giffels added a commit to giffels/tardis that referenced this pull request Feb 24, 2023
@giffels giffels mentioned this pull request Feb 24, 2023
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.

5 participants