Skip to content

Latest commit

 

History

52 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

    _            _    _                   _    _               _    _                            _        _     _   _
   / \    _   _ | |_ | |__    ___  _ __  | |_ (_)  ___   __ _ | |_ (_)  ___   _ __              / \      / \   | | | |
  / _ \  | | | || __|| '_ \  / _ \| '_ \ | __|| | / __| / _` || __|| | / _ \ | '_ \   _____    / _ \    / _ \  | | | |
 / ___ \ | |_| || |_ | | | ||  __/| | | || |_ | || (__ | (_| || |_ | || (_) || | | | |_____|  / ___ \  / ___ \ | |_| |
/_/   \_\ \__,_| \__||_| |_| \___||_| |_| \__||_| \___| \__,_| \__||_| \___/ |_| |_|         /_/   \_\/_/   \_\ \___/

A custom, secure Two-Factor Authentication (2FA) service built with Flask for a cybersecurity project at AAU. It demonstrates secure user login using Email Time-based One-Time Passwords (TOTP).

Test out the product at: authentication-aau.onrender.com/

Features

  • Two-Factor Authentication (2FA) via Email TOTP: Secure login requires both a password and a time-sensitive, single-use code.
  • User Account Management: Secure creation and validation of new user accounts.
  • Account Configuration: Includes functionality for changing password, updating username, and permanent account deletion.

Installation & Setup

Warning

This project is made to be ran on a server using the gunicorn python libary, but can be ran locally like showed firstly here.

  1. Clone the repository
# Clone this repository with git
git clone https://github.com/BertramAakjaer/Authentication-AAU.git

# Open the directory in terminal
cd Authentication-AAU/
  1. Install requirements
python -m pip install -r requirements.txt
  1. Setup a database with supabase using this SQL code
CREATE TABLE public.users (
  id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
  created_at timestamp with time zone NOT NULL DEFAULT (now() AT TIME ZONE 'utc-1'::text),
  last_modified_at timestamp with time zone DEFAULT (now() AT TIME ZONE 'utc-1'::text),
  email text UNIQUE,
  username text,
  password text,
);
  1. Setup a Mailjet account and get the API tokens

  2. Configure your API tokens/secrets in a .env like the one showed here:

# Used by the Mailjet API for sending the authentication codes via email.
MAILJET_PUBLIC="<your_mailjet_api>"
MAILJET_SECRET="<your_mailjet_secret>"
EMAIL_SENDER="<an_email_to_send_mails_from>"

# API keys for Supabase, which is used as our database
SUPABASE_URL="https://<your_hidden_url>.supabase.co"
SUPABASE_KEY="<your_supabase_key>"

# A secret key used to sign and verify JWT tokens
JWT_SECRET="<a_randomly_generated_secret_key>"

Usage

Note

Here is shown 2 different ways to run the program, nr. 1 is for running the program locally in debug mode, and nr. 2 is in a production enviroment, like on a server.

  1. Locally in debug mode
    Run the app script:
python app.py
  1. In production (We use the serrvice render which is free for limited use)
    Run the app script, but with gunicorn:
gunicorn app:app

Technical Details

Will be added later

Python Libaries

  • Flask - Python webserver libary for hosting html content and handeling backend
  • bcrypt - Libary for secure hashing and hash validation
  • PyJWT - Used for creating and validating JWT tokens

🥶 Development Team


About

The product of Gr 3 DC1 in 2025 on Aalborg Unicersity Copenhagen.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages