-
Notifications
You must be signed in to change notification settings - Fork 16
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
User Authentication Management #37
User Authentication Management #37
Conversation
Solved go version workflow error
Jwt token and register added in auth
Auth added
register function updated
Auth Updated
Auth Updated
Login function added
React error removed
backend/main.go
Outdated
r.HandleFunc("/links/all", router.GetAllLinks).Methods(http.MethodOptions, http.MethodGet) | ||
r.HandleFunc("/generate-token", auth.GenerateJWT).Methods(http.MethodOptions, http.MethodGet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
token should be generated on login only
backend/pkg/auth/auth.go
Outdated
"os" | ||
"time" | ||
|
||
"github.com/dgrijalva/jwt-go" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This jwt implementation is no longer maintained
use this instead github.com/golang-jwt/jwt - publicly maintained version of the same project
backend/pkg/auth/auth.go
Outdated
http.Redirect(w, r, url, http.StatusSeeOther) | ||
} | ||
|
||
func Register(w http.ResponseWriter, r *http.Request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of register, give a add new user functionality to the admin
…/main login page component
adding login page and auth to existing code
PR for front-test branch
Removed old testing code.
No Expiry Function added
…-test Fixed positioning of Login page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are accessibility issues in these changes.
QR Code | ||
</Button> | ||
<Grid> | ||
<img src={qrimage}/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This image is missing a text alternative. This is a problem for people using screen readers.
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.