Skip to content

Commit

Permalink
Check whether credentials are missing before using them
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
  • Loading branch information
wallyqs committed Apr 28, 2022
1 parent 9c077d0 commit 279059c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nats.go
Expand Up @@ -1051,6 +1051,12 @@ func UserJWT(userCB UserJWTHandler, sigCB SignatureHandler) Option {
if sigCB == nil {
return ErrUserButNoSigCB
}
// Smoke test the user callback to ensure it is setup properly
// when processing options.
if _, err := userCB(); err != nil {
return err
}

o.UserJWT = userCB
o.SignatureCB = sigCB
return nil
Expand Down

0 comments on commit 279059c

Please sign in to comment.