add auth middleware

This commit is contained in:
2026-02-23 16:39:04 -05:00
parent af9c23c521
commit 11eb192e2a
4 changed files with 89 additions and 5 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ func (s *AuthService) GenerateToken(userID int, email string) (string, error) {
}
func (s *AuthService) ValidateToken(tokenString string) (*Claims, error) {
token, err := jwt.ParseWithClaims(tokenString, &Claims, func(token *jwt.Token) (interface{}, error) {
token, err := jwt.ParseWithClaims(tokenString, &Claims{}, func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, errors.New("unexpected signing method")
}