Giter Site home page Giter Site logo

aliboucoding_jwt_security's Introduction

JWT Security

Overview

This project showcases the implementation of JWT (JSON Web Token) security in a Spring Boot application using Spring Security. The primary features include user registration and login, with user data stored in a PostgreSQL database. The application provides robust authentication mechanisms, allowing users to create new accounts and securely log in.

Technologies Used

  • Spring Boot 3
  • Spring Security 6
  • PostgreSQL 12
  • Docker
  • Docker Compose

Prerequisites

Before running the project, ensure that you have the following software installed on your machine:

  • Docker
  • Docker Compose
  • Postman
  • Java 17

Setup Instructions

  1. Clone the Repository:

    git clone https://github.com/aagun/aliboucoding_jwt_security.git
  2. Navigate to the Project Directory:

    cd aliboucoding_jwt_security
  3. Run Docker Compose:

    Execute the following command to start PostgreSQL using Docker Compose:

    docker-compose up -d
  4. Run the Spring Boot Application:

    Open the project in your favorite Java IDE or use the following command to run the application:

    ./mvnw spring-boot:run
    1. Testing Endpoints:

      Use Postman to test the following endpoints:

      • Register User:

        • URL: http://localhost:8080/api/auth/register
        • Method: POST
          • Request Body:
            {
               "firstName": "your-firstname",
               "lastName": "your-lastname",
               "email": "your-email",
               "password": "your-password"
            }
      • Login:

        • URL: http://localhost:8080/api/auth/login
        • Method: POST
        • Request Body:
          {
              "email": "your-email",
              "password": "your-password"
          }
  5. Stopping the Project:

    When you're done, stop the Spring Boot application and the Docker containers using the following commands:

    • Stop the Spring Boot application:

      # Press Ctrl + C in the terminal where the application is running
    • Stop the Docker containers:

      docker-compose down -d --remove-orphans

Notes

  • Make sure to replace placeholders like your-email, your-password and etc.. with your desired values.
  • Ensure Docker and Docker Compose are running before starting the application.
  • You may customize the database configurations in the application.yml file if needed.

Acknowledgments

Special thanks to Alibou Coding's YouTube channel for providing valuable tutorials on JWT security with Spring Boot.

License

This project is licensed under the MIT License.

aliboucoding_jwt_security's People

Contributors

aagun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.