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

update to work with hapi 17 #145

Closed benib closed 6 years ago

benib commented 6 years ago

This makes the plugin work with hapi 17. It is a breaking change, tests are updated to work with the new version.

Let me know if you want me to change something.

benib commented 6 years ago

All the tests now use async/await as they should as server.inject is an async function. I had to change the behaviour in test number 10 "returns 500 when strategy returns a regular object to validateFunc". This test was named confusingly to test for status 500 but in fact tested for status 200 and the thrown object to be in the body.

I changed this to test against status 500 as hapi responds with this if an error object is returned from the handler function.

Not sure if this change makes sense or if there should be a case where the validation function could throw resulting in status 200 in the end.

bricss commented 6 years ago

When it's planned to land?

benib commented 6 years ago

@AdriVanHoudt just let me know if I can help here in any way...

bricss commented 6 years ago

Someone has to release a new version 🙌

johnbrett commented 6 years ago

Sorry being the bottleneck! Reviewing now!

johnbrett commented 6 years ago

Ok, I've created PR of changes I'd like to make on top these here: https://github.com/benib/hapi-auth-bearer-token/pull/1 so it's easier to see the proposed changes.

@benib @AdriVanHoudt can you review? If you're happy with those @benib can you merge it that PR, I'll merge this one and we can get this version out tomorrow.

benib commented 6 years ago

@johnbrett the PR https://github.com/benib/hapi-auth-bearer-token/pull/1 is merged. So from my point of view this is all good. Thanks a lot for the collaboration to you and @AdriVanHoudt ❤️

AdriVanHoudt commented 6 years ago

Thank you for the PR 🎉