MicrosoftStudentChapter / Linky

An open source URL shortener server with custom URLs, expiry dates being developed in GoLang
5 stars 15 forks source link

User Authentication Management #37

Open PreetinderSinghBadesha opened 1 week ago

PreetinderSinghBadesha commented 1 week ago

This pull request is related to #17 and implements essential user authentication features in the backend. The following functionalities have been added:

Generation of JWT: Added functionality to generate a JSON Web Token (JWT) with parameter username The JWT contains user-specific information and is set to expire after a predefined duration.

Validation of JWT: Implemented middleware to validate incoming JWTs. Ensures that only authenticated requests can access protected endpoints by verifying the token's signature and expiration.

Registration of User: Added a user registration endpoint to allow new users to create accounts.

Redirecting User After Logging In: Upon successful login, the user is provided with a JWT and redirected to the appropriate dashboard or homepage.