User Authentication design pattern?

I read http://www.sitepoint.com/building-a-domain-model/
And, I don’t find any authenticate($email, $password) method to check if the user email and password exists
Where should the method authenticate($email, $password) exists ?
Should it be in the User class, or UserMapper class, or should we need to build UserAuthenticate Class ?

Hi Terry,

I know you posted this question over a week ago, but I only just noticed it while looking over the unanswered threads.

Adding the functionality to the User or UserMapper classes would violate the Single Responsibility Principle (SRP), so yes, it would be better to create a separate authentication service to deal with logging users in and out.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.