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

Implement jwt #28

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Implement jwt #28

wants to merge 10 commits into from

Conversation

JVPH
Copy link

@JVPH JVPH commented Mar 23, 2024

  • Updating User Model: By changing the primary key from email address to an auto-incremented ID, we enhance the system’s flexibility. Email addresses can change, which could lead to complications with foreign key relationships. An auto-incremented ID remains constant, providing a more stable reference point. Additionally, keeping the email as a unique field ensures that each user has a unique identifier beyond the primary key.
  • JWT Based Authentication: Implementing JWT (JSON Web Tokens) based authentication provides a secure and scalable method for user authentication. JWTs are stateless, meaning the server does not need to store session data. This makes the system more scalable and reduces server load.
  • Use Django's built in functions for password checking/hashing: Django’s make_password and authenticate abstract away the details of password hashing and checking (They handle the salting and hashing of passwords). This makes the code simpler and easier to read.
  • Protecting Views: By requiring a bearer token in the auth headers for multiple endpoints, we ensure that only authenticated users can access these resources. Also updated the views to match the new primary key and to make use of the JWT to get user info.

To do: Update tests to match the new/changed functionality.

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.

1 participant