Skip to content

A spring-boot application to demonstrate JWT Auth with signup and login API's

Notifications You must be signed in to change notification settings

naeemark/jwt-auth-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT Auth Service

Master Branch Coverage Quality Gate Status Docker

Demonstration of Requirements understanding, proposing a solution and implementation by using the latest tools and techniques.


Distribution


What is this repository for?

  • This app is built as assignment for AirAsia - KL.
  • Adds different libs to enhance the application quality and performance.
  • Using SWAGGER.IO for documentation and as a working REST-API client
  • CI/CD Demonstration using Github Actions
  • Docker containers are used for Build Deployment
  • The live environment is established on KubeSail as per the instructions
  • Version 1.0.0

Problem Statement:

Problem Statement


Proposed Schema:

  • By keep the provided instructions in mind, I would prefer to use a Spring Boot application for the implementation of required functionality.
  • Postgres Database will be used for Dev, Test and Prod environments.
  • For unit testing, I would prefer to use JUnit

Entities

  • It is clear by the requirements that there will be One entity
    • Users
  • As we have already finalized the attributes of the Entity, so, IMO, RDBM is fine for the situation
    • The user_name and email both should be unique attributes

Proposed Schema:

Problem Schema

Deliverable Content

Functional Implementation

  • POST {baseURL}/api/signup - returns the accessToken asn User attribute
  • POST {baseURL}/api/login - returns the accessToken asn User attribute

Non-Functional Implementation

  • GET {baseURL}/api/health - Checks the health of the system,
  • GET {baseURL}/api/user - Gets the User object based on provided JWT in header

Development Cycle:

How do I get set up?

How to set up

To set-up the project locally you need to clone this repo, from master or develop branch or some latest TAG

Configuration

  • Please sync and resolve the maven dependencies
  • Run mvn clean install
  • To run tests mvn clean test
Build Docker Image
  • docker build -t jwt-auth-service .
Run Docker Image
Run Docker Image From Docker hub
Stop Docker Container
  • Run docker kill {container-id}

Pre-reqs

  • JDK 1.8
  • Spring Boot
  • Docker
  • Postgres
  • JWT
  • Junit
  • IntelliJ IDEA

Tools Included

  • Jacoco
  • Sonar
  • Swagger
  • JPA
  • Hibernate
  • Github Actions
  • KubeSail

Auth

  • JWT Tokens are used as authorization

External Tools:

Deployment

  • When a pull request is merged in master, Github Action starts and following steps are done by automated CI/CD:

    • Creates Environment and Runs all tests
    • Complete a SonarQube analysis and pushes the results to Live Project
    • Makes a deployment to Github packages (Mock)
    • Creates the Docker Image and pushes to Docker Repository
  • As a next step, login to KubeSail instance and deploy accordingly

Contribution guidelines

  • Forks are always appreciated