feat: jwt authentication

This commit is contained in:
Robin Dittmar
2026-07-21 13:47:59 +02:00
parent 1cdb0ebefa
commit d9bfcea420
12 changed files with 296 additions and 10 deletions
+25
View File
@@ -0,0 +1,25 @@
package request
import (
"encoding/json"
"fmt"
"net/http"
)
type LoginPayload struct {
Email string `json:"email"`
Password string `json:"password"`
}
func DecodeLogin(r *http.Request) (LoginPayload, error) {
var payload LoginPayload
decoder := json.NewDecoder(r.Body)
decoder.DisallowUnknownFields()
if err := decoder.Decode(&payload); err != nil {
return payload, fmt.Errorf("error decoding login payload: %w", err)
}
return payload, nil
}