Running the application and testing

Run the project by executing the following command:

mvn jetty:run

Wait for the console to print [INFO] Started Jetty Server.

Open a browser (I use Firefox in private mode for testing) and navigate to http://localhost:8080, and you will be shown the custom login page that you created, as shown in the following screenshot:

Figure 1: The custom login page

Enter user/user@password as the username and password. Click on Remember me and click the Login button, and you will be navigated to the user home page, as shown here:

Figure 2: User home page

Query your MySQL database for the persistent_logins table, and you will see a new record, as shown in the following screenshot:

Figure 3: MySQLWorkbench querying new persistent_logins table

Now, go to the developer tools in your browser and check for cookies. Depending on the browser that you are using, you should see something similar to this:

Figure 4: Browser cookie set to achieve remember-me functionality

The entire project for this example can be found at the book’s GitHub page in the jetty-db-basic-authentication-remember-me project.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.67.40