jwt icon indicating copy to clipboard operation
jwt copied to clipboard

Implement a BearerExtractor

Open WhyNotHugo opened this issue 3 years ago • 0 comments
trafficstars

This is a rather common extractor; it extracts the JWT from the HTTP Authorization header, expecting it to include the "Bearer " prefix.

This patterns is rather common and this snippet is repeated in enough applications that it's probably best to just include it upstream and allow reusing it.

WhyNotHugo avatar Aug 10 '22 13:08 WhyNotHugo

Good idea. May I suggest an alternative name like AuthorizationHeaderExtractor or do you think that is too long?

oxisto avatar Aug 10 '22 18:08 oxisto

I have this in literally every project, haha. I'd suggest something like GetTokenFromHeader

mfridman avatar Aug 10 '22 19:08 mfridman

I have this in literally every project, haha. I'd suggest something like GetTokenFromHeader

There is already a TokenExtractor which loops through all tokens, since this is specific to a bearer token we might as well stick with the original name.

oxisto avatar Aug 11 '22 06:08 oxisto