/aah-form-based-auth

aah framework Form Based Auth Example, but use MySQL database as back-end store.

Primary LanguageGo

The code was written for this article.

Example - Form based Auth using a database

This example is based on the official example (Example - Form based Auth) but uses a MySQL database as backend storage. Form based auth includes authentication, route authorization via routes config, access permissions on view files and session access on View files.

Learn more about Security design, Authentication, Authorization and Form Auth scheme.

Usage

Database installation

Create MySQL database and import data

The db schma with demo data is located at docs/dbschema/schema.sql

Database configuration

edit config file: config/aah.conf

database {
  driver = "mysql"
  host = "localhost"
  port = "3306"
  username = "root"  # change to yours
  password = "mysql" # change to yours
  name = "aah-form-based-auth"  # change to your db
  max_idle_connections = 20
  max_active_connections = 30
  max_connection_lifetime = 2
}
git clone https://github.com/vulcangz/aah-form-based-auth.git

RabbitMQ Server

You need to have a running RabbitMQ server with the default URI "amqp://guest:guest@localhost:5672/" available.

Run this example

cd aah-form-based-auth
aah run

Visit this URL

The application will take you to the login page. From there, it is self explanatory. Happy coding!

Navigate these URLs with various credentials listed on the login page. Observe the application logs to learn more.

Credits and Inspiration