A Complete Backend Service with User Authentication and Authorization
- Description
- Features
- Getting Started
- Docker Deployment
- Testing
- Technologies and Tools
- Contributions
- License
This repository contains a backend service developed in GoLang that handles user authentication and authorization.
It includes functionalities like user registration, login, password reset, social authentication (e.g., GitHub, Google), and JWT authentication.
The service is designed with security in mind, implementing measures to prevent common attacks such as SQL injection, CSRF attacks, and brute force attacks.
- User Management
- User Authentication
- User Registration: Allows new users to create an account.
- User Login: Allows existing users to log in.
- User Logout: Allows users to log out.
- RBAC: Implements Role-Based Access Control (RBAC) for users.
- Session Management
- Create Session: Creates a session when a user logs in.
- Destroy Session: Destroys the session when a user logs out.
- Password Management
- Password Reset: Allows users to reset their password.
- Password Hashing: Hashes passwords before storing them in the database.
- Social Authentication: Allows users to log in using their social media accounts.
- GitHub Authentication: Allows users to log in through GitHub
- Google Authentication: Allows users to log in through Google
- JWT Authentication: Uses JSON Web Tokens (JWT) for secure information transmission.
- Security Measures
- SQL Injection Prevention: Prevents SQL injection attacks.
- CSRF Prevention: Prevents Cross-Site Request Forgery (CSRF) attacks.
- Slowloris Prevention: Prevents Slowloris Attacks
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Go (version 1.15 or later)
- Make
- Clone the repository
git clone https://github.com/goodnessuc/authsystem.git
- Change directory to the project folder
cd authsystem
- Install dependencies
make install
- Build the application
make build
- Run the application
./cmd/server/main.go
- Ensure that Docker and Docker Compose are installed on your machine.
- Navigate to the project directory:
cd authsystem
- Build and run the application and its services using Docker Compose:
docker-compose up --build
To stop the services, simply run:
docker-compose down
To run the tests, run the following command:
make test
- Go - The programming language used
- GORM - Database ORM tool
- The Gin Gonic Framework - Go based HTTP routing tool
- JWT - JSON Web Tokens for authentication
- Docker - Containerization tool
- Docker Compose - Tool for defining and running multi-container Docker applications
- PostgreSQL - Database
- OAuth 2.0 - Open standard for access delegation
- Make - Build automation tool
Contributions, issues, and feature requests are welcome!
MIT