gofiber / jwt

⚠️ Deprecated repository, available within Fiber Contrib.
https://github.com/gofiber/contrib/tree/main/jwt
MIT License
393 stars 31 forks source link

Empty AuthScheme not possible for headers #118

Closed 418Coffee closed 1 year ago

418Coffee commented 1 year ago

Hello,

I'm trying to do something similar to #103, extract a JWT from a custom header field.

{
    "X-Auth": "eyJ....."
}

I believe currently, it's impossible to achieve this, because an empty AuthScheme value gets interpreted as default and set to "Bearer":

if cfg.AuthScheme == "" {
    cfg.AuthScheme = "Bearer"
}

Perhaps we can default AuthScheme to "Bearer" if AuthScheme == "" && TokenLookup == defaultTokenLookup. Please let me know what you think about this. I would be happy to make a PR.

gaby commented 1 year ago

@418Coffee Send a PR, as long as it's backwards compatible should be fine. :-)