Authentication is one of those things it's important to get right, and avoiding re-inventing the wheel is a good way to avoid common mistakes.
It would be well worth mentioning modules like Dancer2::Plugin::Auth::Extensible which will handle all the basic stuff for you, in a battle-tested way.
In particular, your hand-rolled version in this post makes no attempt to remember that you logged in or show how to protect access to any other routes in the app.
Thanks David. This article is just to understand how the authentication works in Dancer2. My next article is on the Dancer2 Authentication using MySQL (as database), where your mentioned plugin Dancer2::Plugin::Auth::Extensible is in use and, for encryption Crypt::PBKDF2 and the DBIX for querying database.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Authentication is one of those things it's important to get right, and avoiding re-inventing the wheel is a good way to avoid common mistakes.
It would be well worth mentioning modules like Dancer2::Plugin::Auth::Extensible which will handle all the basic stuff for you, in a battle-tested way.
In particular, your hand-rolled version in this post makes no attempt to remember that you logged in or show how to protect access to any other routes in the app.
Thanks David. This article is just to understand how the authentication works in Dancer2. My next article is on the Dancer2 Authentication using MySQL (as database), where your mentioned plugin Dancer2::Plugin::Auth::Extensible is in use and, for encryption Crypt::PBKDF2 and the DBIX for querying database.