johnbrett / hapi-auth-bearer-token

Simple Bearer authentication scheme plugin for hapi, accepts token by Header, Cookie or Query parameter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose the bearer token validator to the server?

jonathansamines opened this issue · comments

Hey thanks for this incredible plugin, I was wondering if it was possible to expose the validator logic to the hapi server. I have found useful to extend this module functionality for example with token validation functionality, to move all the token validation away into a plugin. Bell already does that.

What do you think? I can help with that if it is something that makes sense for you.

Hey @jonathansamines, that sounds like a cool idea, and shouldn't need much work. Where would you see yourself using it?

To make the update will need to update:

  • lib/index.js: add a plugin.expose()
  • test/index.js: add a test and ensure we still have 100% coverage
  • README: update the documentation

@johnbrett sorry for the delay, I´m currently dealing with a custom token-validation logic, which uses the bearer token scheme, so I was trying to use this plugin as part of other plugin, to validate the bearer-token format and then use my custom logic in the other plugin.

It seems like hapi doesn´t support multi-step authentication strategies, so the only way to combine multiple strategies together is by exposing that kind of interface.

Hey @jonathansamines, sorry for the delay myself this time. That makes sense. Do you want to try put together a PR for this and we can work through it ?

Hey @jonathansamines - haven't had any activity on this a while so will close it. If you want to work further on this, feel free to re-open - happy to work on it with you.