Skip to content

Commit

Permalink
Fixup no custom claims
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Apr 15, 2024
1 parent 1e51845 commit f2210f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ func Rollout(w http.ResponseWriter, r *http.Request) {
return
}

if claims, ok := token.Claims.(jwt.MapClaims); ok {
ccStr := os.Getenv("CUSTOM_CLAIMS")
log.Println(ccStr)
ccStr := os.Getenv("CUSTOM_CLAIMS")
claims, ok := token.Claims.(jwt.MapClaims)
if ok && ccStr != "" {
var cc map[string]string
err = json.Unmarshal([]byte(ccStr), &cc)
if err != nil {
Expand All @@ -74,7 +74,7 @@ func Rollout(w http.ResponseWriter, r *http.Request) {
return
}
}
} else {
} else if !ok {
log.Println("Unable to read token claims for", realIp, ",", lastIP)
http.Error(w, "Invalid token", http.StatusUnauthorized)
return
Expand Down

0 comments on commit f2210f0

Please sign in to comment.