flask-rebar
flask-rebar copied to clipboard
Feature: Post Authentication Hook
Ran into a use case where a dev wanted to run some code before all handlers after authentication had run. The dev was trying to use the before_request
hook which probably would have worked if we were doing auth in middleware or with a hook like other frameworks do.
Unfortunately as it stands the only way to do this in rebar currently is to modify the Authenticator. This seems like something that we should really have a hook for so that devs can easily add code to be run after authentication but before the handler.
Where would you put this parameter? In the registry constructor? Otherwise I feel like a simple decorator could do the trick.
No parameter. Either the rebar object or the registry object would hold the hook function list reference and expose the method to register(add) another function to be run after authentication but before the handler.