NancyFx / Nancy

Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono
http://nancyfx.org
MIT License
7.15k stars 1.47k forks source link

Is there a nancy equivalent of flasks' decorators? #2968

Closed NateKomodo closed 5 years ago

NateKomodo commented 5 years ago

Description

In flask, you can put something like @login_required over a route, and code will be run before the route, such as that of verifying the user has a specific cookie, or is logged in, and can also pass in more arguments into the method, such as a user pbject. Does nancy have an equivalent of this? If so, how do I implement it?

jonorossi commented 5 years ago

The docs discuss authentication including the RequiresAuthentication extension method.

https://github.com/NancyFx/Nancy/wiki/Authentication-overview