ggicci / caddy-jwt

🆔 Caddy Module JWT Authentication
MIT License
71 stars 20 forks source link

jwk_url error is never logged #79

Closed jchamberlain closed 5 months ago

jchamberlain commented 5 months ago

Thank you for this module! It seems to be exactly what I need, but I'm running into some trouble debugging why my jwk_url is not working, and unfortunately caddy-jwt doesn't tell me why. (This ticket is a request to change the logging behavior, not a request for help troubleshooting my setup.)

In jwt.go, in setupJWKLoader(), any errors from loading the URL are ignored:

// ignore any error loading the JWKS endpoint now as it may not be available at startup
_ = ja.refreshJWKCache()

On a later refresh, errors are similarly dropped:

// trigger a refresh if the key is not found
go ja.refreshJWKCache()

Could one or both of these be adjusted to log the error?

ggicci commented 5 months ago

Sure, will look into this.