Skip to content

Commit

Permalink
Reject empty secret on HTTP handler. Use KeyRegister with empty entry…
Browse files Browse the repository at this point in the history
… if you need to.
  • Loading branch information
pascaldekloe committed Mar 11, 2019
1 parent d99818e commit 5046a87
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions web.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,12 @@ type Handler struct {
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// verify claims
var claims *Claims
var err error
err := ErrAlgUnk
if h.Keys != nil {
claims, err = h.Keys.CheckHeader(r)
} else if h.ECDSAKey == nil && h.RSAKey == nil {
} else if h.ECDSAKey == nil && h.RSAKey == nil && len(h.Secret) != 0 {
claims, err = HMACCheckHeader(r, h.Secret)
} else {
err = ErrAlgUnk
if h.RSAKey != nil {
claims, err = RSACheckHeader(r, h.RSAKey)
}
Expand Down

0 comments on commit 5046a87

Please sign in to comment.