Giter Club home page Giter Club logo

greenstitch_assingment's Introduction

GreenStitch_Assingment

This project is a backend implementation for a login and signup REST API with security and JWT tokens using Spring Boot.

Installation

  1. Clone the repository:

    git clone https://github.com/Lakhan1122/GreenStitch_Assingment.git

  2. Navigate to the project directory:

    cd GreenStitch_Assingment

  3. Build the project using Maven:

     mvn clean install
    

Setup

  1. Open the application.properties file located in the src/main/resources directory.

  2. Configure the H2 database:

    spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password=

  3. Configure JWT properties:

    jwt.secret=YourSecretKey jwt.expiration=86400000

  4. Run the application using Maven:

     mvn spring-boot:run
    
  5. The application will start and listen on the default port 8080.

API Endpoints

The following API endpoints are available:

POST /api/auth/signup: Register a new user.

POST /api/auth/login: Authenticate a user and retrieve a JWT token.

Usage

You can test the API endpoints using tools like Postman or cURL.

1.Register a new user:

Send a POST request to /api/auth/signup. Provide the username and password in the request body. Receive a response indicating whether the user was registered successfully.

  1. Authenticate a user and retrieve a JWT token:

Send a POST request to /api/auth/login. Provide the username and password in the request body. Receive a response containing a JWT token.

  1. Use the JWT token for authenticated requests:

Include the JWT token in the Authorization header of subsequent requests. The token should be in the format: Bearer . Validate the token on the server-side to authorize access to protected resources.

Technologies Used

  Java,
  Spring Boot,
  Spring Security,
  H2 Database,
  JSON Web Tokens (JWT)

Feel free to modify the instructions to match the specifics of your project.

Thank Your!

greenstitch_assingment's People

Contributors

lakhan1122 avatar

Stargazers

yash kallewar 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.