Implementing the user authentication for the Inventory module
For authenticating the user, we will use the laminas-authentication
component. Add and install the laminas-authentication
component in the same way you did with the laminas-db
component, using Composer. Open the composer.json
file in Eclipse, and through the Dependencies tab, search for the laminas/laminas-authentication
package and add it. Don’t forget to save the file and click on the Update dependencies button. If you have any doubt about how to install Composer dependencies with Eclipse, read the Creating our first automated test section in Chapter 3, Using Laminas as a Library with Test-Driven Development.
After installing laminas-authentication
, we can use this component to modify the IndexController->loginAction
method. This method will look like this:
public function loginAction()
{
$nickname = ...