Skip to content

Commit

Permalink
fix: avoid panic if validation token is not setup properly
Browse files Browse the repository at this point in the history
  • Loading branch information
MalinAhlberg committed Oct 31, 2023
1 parent 2f304ee commit bad25c0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sda/internal/userauth/userauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func NewValidateFromToken(keyset jwk.Set) *ValidateFromToken {
// Authenticate verifies that the token included in the http.Request is valid
func (u *ValidateFromToken) Authenticate(r *http.Request) (jwt.Token, error) {
// Verify signature by parsing the token with the given key
if u == nil {
return nil, fmt.Errorf("error validating token keyset")
}
switch {
case r.Header.Get("Authorization") != "":
authStr := r.Header.Get("Authorization")
Expand Down

0 comments on commit bad25c0

Please sign in to comment.