Hi Marcelo,
I would advice to first understand what the defaukt authentication logic is that the aoolicatuon template provides, and then change it to your needs.
You can change the code that is provided in the common flow for login.
The exception handler is crucial to redirect a user to login screen when not yet authenticated and also to redirect to a no permission screen if a logged in user tried to access a screen he or she has no permission to.
Regards,
Daniel