johnbrett / hapi-auth-bearer-token

Simple Bearer authentication scheme plugin for hapi, accepts token by Header, Cookie or Query parameter.
MIT License
218 stars 46 forks source link

New feature: multiple auth token names #213

Open hololoev opened 10 months ago

hololoev commented 10 months ago

Hello guys!

In our private project we need to use different token names in the same auth strategy. So we made a patch for your code. If you like, you can merge this feature to original project. Unfortunately I cannot make MR, so I only can send you a link to repo: https://gitlab.com/hololoev/hapi-auth-bearer-token-token-multiname

Diffs:

accessTokenName (Default: 'access_token') - Rename token key e.g. 'new_name' would rename the token query parameter to /route1?new_name=1234. Alternatively can be assign as array of strings: accessTokenName: [ 'access_token', 'custom_access_token' ]

And:

tokenType (Default: 'Bearer') - Accept a custom token type e.g. Authorization: Basic 12345678. Alternatively can be assign as array of strings: accessTokenName: [ 'Bearer', 'Customkey' ]

johnbrett commented 10 months ago

Hey @hololoev thanks for this! Is there any reason why you can't make an MR, there shouldn't be any permission issues?

hololoev commented 10 months ago

Yes, I have no permissions

johnbrett commented 10 months ago

you shouldn't need any it's a public repo, anyone can create a pull request like they can create an issue :)

if you push the above linked repo on gitlab to github, or clone this and make the changes I think it'll even prompt you on how to make an MR.

hololoev commented 10 months ago

image

johnbrett commented 10 months ago

ah, you need to clone the repo and push to your clone, the you can make an MR from your clone to this repo!

hololoev commented 10 months ago

Hahaha)) Yes I'm a little bit stupid. Done.