fix: access sub directly

This commit is contained in:
Derrick Hammer 2024-01-17 08:57:45 -05:00
parent e9aa676d94
commit bf65e845f3
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 3 deletions

View File

@ -42,9 +42,9 @@ func AuthMiddleware(handler jape.Handler, portal interfaces.Portal) jape.Handler
}
if claim, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {
subject, err := claim.GetSubject()
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
subject, ok := claim["sub"].(string)
if !ok {
http.Error(w, "Invalid User ID", http.StatusBadRequest)
return
}