Where to place the login/authentication related actions in MVC
- by rogeriopvl
I've searched around and found that when implementing an authentication module in MVC architecture some people opt to place the login related actions in the User controller while others place it in a controller dedicated to authentication only.
In pseudo-java-like code:
class UserController extends Controller {
public login() {
//...
}
}
Accessed with http://mydomain.com/user/login.
vs.
class AuthController extends Controller {
public login() {
//...
}
}
Accessed with http://mydomain.com/auth/login.
I would like to know which approach is better, and why. That is, if there's really any difference at all.
Thanks in advance.