My way to authenticate users using Spring Security
To run it without any changes, you need to have a MySQL database.
Then you can modify the spring config file (application.yml) to use your own DB.
You can custom the User entity for your own need, the application will create the table.
It is RESTful because it is completely stateless.
The server won't use Java's sessions but will instead create a Json Web Token and set a new header in the response.
As it is a custom header, you also need to expose it, otherwise the client will not receive it.
As it is stateless, the client needs to send the header for each request.