Skip to content

Commit

Permalink
ghwf debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley committed Feb 5, 2024
1 parent 229f77f commit 8102694
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 0 additions & 4 deletions backend/src/errors/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,4 @@ var (
StatusCode: fiber.StatusInternalServerError,
Message: "failed to cast to custom claims",
}
ExpectedClaimsButGotNil = Error{
StatusCode: fiber.StatusInternalServerError,
Message: "expected claims but got nil",
}
)
3 changes: 3 additions & 0 deletions backend/src/middleware/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ func SuperSkipper(h fiber.Handler) fiber.Handler {
err.FiberError(c)
return false
}
if claims == nil {
return false
}
return claims.Role == string(models.Super)
})
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/types/custom_claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type CustomClaims struct {
func From(c *fiber.Ctx) (*CustomClaims, *errors.Error) {
rawClaims := c.Locals("claims")
if rawClaims == nil {
return nil, &errors.ExpectedClaimsButGotNil
return nil, nil
}

claims, ok := rawClaims.(*CustomClaims)
Expand Down

0 comments on commit 8102694

Please sign in to comment.