Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Use ParseInsecure in mock authenticator
  • Loading branch information
kian99 committed Jun 12, 2024
1 parent c9b8acb commit fa39cc5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/jimmtest/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ func NewMockOAuthAuthenticator(secretKey string) MockOAuthAuthenticator {

// VerifySessionToken provides the mock implementation for verifying session tokens.
// Allowing JIMM tests to create their own session tokens that will always be accepted.
// Notice that no key is passed to jwt.Parse to skip JWT signature verification.
// Notice the use of jwt.ParseInsecure to skip JWT signature verification.
func (m MockOAuthAuthenticator) VerifySessionToken(token string) (jwt.Token, error) {
decodedToken, err := base64.StdEncoding.DecodeString(token)
if err != nil {
return nil, errors.New("authentication failed, failed to decode token")
}

parsedToken, err := jwt.Parse(decodedToken)
parsedToken, err := jwt.ParseInsecure(decodedToken)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit fa39cc5

Please sign in to comment.