[Flask] Add authentication to auto generated URLs
gergely at polonkai.eu
Wed Mar 1 16:42:54 EST 2017
As it’s a plain decorator, you can use
Hint: if you need to use a decorator that requires parameters, use
something like this:
You can also nest them:
On Wed, Mar 1, 2017, 10:48 Christof Verdonck <
hcmr.verdonck.christof at gmail.com> wrote:
> I am a quiet new developer for both Python and Flask.
> To authenticate my Flask application, I am using the Flask extension:
> flask-httpauth/ <http://github.com/miguelgrinberg/flask-httpauth/>
> To have a secured endpoint, I just add the @auth.login_required decorator
> to the @app.route endpoint definition as shown here under:
> def secret_page():
> return send_from_directory(app.static_folder, 'secret_page.html')
> Now, I have some endpoints that I add dynamically as here under:
> 'secret_page_url/', view_func=view_func, methods=['POST', ])
> I would like to add also authentication for these URLs but I can't figure out how this is done.
> It seems that the solution I have now, adds authentication on the adding of the rule instead
> of on the accessing of the URL.
> Can someone please give me a hint/solution how this is done?
> Thank you in advance
> Flask mailing list
> Flask at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Flask