rensPols / ex-dock

An ecommerce platform build with Vert.x Kotlin and Docker
Apache License 2.0
3 stars 0 forks source link

Custom authentication provider to secure the web pages and resources #41

Closed Moltensnor closed 4 days ago

Moltensnor commented 2 weeks ago

Adds a custom authentication handler that authenticates the user and if the user has permissions.

Changelist

Database

Made it so the email in the database is a unique value and that we can't have multiple of the same email addresses because of authentication issues.

Auth Handler

The authentication handler can do three things. It can authenticate a user by fetching it from the database and checking if the hashed password corresponds to the given password. If the user is correct, it will convert the user to a user from the Vertx class. This user has a list of permissions, which the authenticator uses to see which permissions are correct when asked.

Examples

There are a couple of use cases in the account router. These use all the methods from the auth class.

Session store

The user gets stored as a hashed session id in the session so that the user doesn't need to log in again.