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

Feature/add session management #23

Merged
merged 4 commits into from
Dec 22, 2024

Conversation

josephpdf
Copy link
Contributor

🚀 StarShop Pull Request


📝 Changes description

  • Implemented session management in the backend.
  • Created a new Session entity in the database to store session information.
  • Added an authenticate middleware to validate sessions using tokens.
  • Protected routes that require authentication.
  • Implemented a function to create and validate sessions during login.
  • Developed functionality to log out by deleting the session from the database.

📸 Evidence (A photo is required as evidence)

Captura de pantalla 2024-12-17 145542
Captura de pantalla 2024-12-17 145556
Captura de pantalla 2024-12-17 145615


⏰ Time spent breakdown

  • 1 hour: Creation of the files and initial repository setup.
  • 2 hours: Development of logic for token generation and storage.
  • 1 hour: Implementation of the authentication middleware.
  • 0.5 hours: Protecting routes with the middleware.
  • 1 hour: Development of the logout functionality.
  • 0.5 hours: Documentation and final adjustments.

🌌 Comments

  • Periodic cleanup of expired sessions can be added in the future using a cron job.
  • It is recommended to use secure cookies (HttpOnly, Secure) instead of storing tokens directly on the frontend.
  • This implementation ensures that only authenticated users can access protected routes, enhancing the backend's security.

Thank you for contributing to StarShop, we are glad that you have chosen us as your project of choice and we hope that you continue to contribute to this great project, so that together we can make our mark at the top!

@josephpdf
Copy link
Contributor Author

@Villarley please check my contribution to see if it requires changes.

Copy link
Contributor

@Villarley Villarley left a comment

Choose a reason for hiding this comment

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

LGTM great work homie!

@Villarley Villarley merged commit 5958dd8 into StarShopCr:main Dec 22, 2024
1 check passed
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.

[BK]: Add Session Management (API and Middleware)
2 participants