flask-rebar icon indicating copy to clipboard operation
flask-rebar copied to clipboard

Feature: Post Authentication Hook

Open airstandley opened this issue 4 years ago • 2 comments

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.

airstandley avatar May 27 '20 22:05 airstandley

Where would you put this parameter? In the registry constructor? Otherwise I feel like a simple decorator could do the trick.

Sytten avatar May 27 '20 23:05 Sytten

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.

airstandley avatar Jun 02 '20 19:06 airstandley