Skip to content

Minyeng/simple-auth-service

Repository files navigation

Simple Auth Service

A fast, lightweight, and secure authentication service built using Java Spring Boot, MySQL, and Docker

Ideal for developers who want a quick and secure way to implement user authentication in their apps. With Docker containerization, this service is also easily deployable and scalable for modern applications.

⚙️ Tech Stack

  • Java 17 (Spring Boot)
  • MySQL (Database)
  • Docker (Containerization)

📦 Getting Started

Prerequisites

  • Docker: Make sure Docker is installed and running.
  • MySQL: MySQL should be configured (will run in a Docker container).

Clone the repository

  git clone https://github.com/your-username/simple-auth-service.git
  cd simple-auth-service

Docker Setup

  1. Build the Docker container:
      docker-compose build
    
  2. Start the application:
      docker-compose up -d
    
  3. The app will now be accessible on http://localhost:8080.

Database Configuration

  • The MySQL database will run in a Docker container and will be automatically configured on startup.
  • You can access the MySQL database on localhost:3306 with the credentials set in the docker-compose.yml file.

🌐 API Endpoints

1. POST /api/users

Register a new user.

Request Body:

{ "usrname": "username", "password": "strongPassword123", "name": "Your Name" }

2. POST /api/auth/login

Login to receive a Token.

Request Body:

{ "username": "username", "password": "strongPassword123" }

3. PATCH /api/users/current

Update the current authenticated user

Headers:

X-API-TOKEN: Token

Request Body:

{ "username": "username", "password": "strongPassword123", "name": "Your Name" }

4. GET /api/users/current

Get the current authenticated user's details.

Headers:

X-API-TOKEN: Token

5. POST /api/auth/logout

Logout and invalidate the token.

Headers:

X-API-TOKEN: Token

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors