Skip to content

asiripr/spring-boot-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Authentication

This repository contains a simple Spring Boot application that demonstrates user authentication and authorization using Spring Security. It provides a RESTful API for user registration and login, utilizing JWT (JSON Web Tokens) for secure token-based authentication.

Features

  • User registration with password hashing
  • User login with JWT token generation
  • Role-based access control
  • Secure API endpoints
  • In-memory database for demonstration purposes

Technologies Used

  • Spring Boot: Framework for building Java applications.
  • Spring Security: Provides authentication and authorization.
  • JWT: For secure token-based authentication.

Getting Started

Prerequisites

Make sure you have the following installed:

  • Java 11 or higher
  • Maven

Clone the Repository

git clone https://github.com/asiripr/spring-boot-auth.git
cd spring-boot-auth

Build the Application

Run the following command to build the application:

mvn clean install

Run the Application

You can run the application using:

mvn spring-boot:run

The application will start on http://localhost:8080.

API Endpoints

User Registration

  • POST /api/auth/register
    • Request Body:
      {
        "username": "exampleUser",
        "password": "examplePassword"
      }

User Login

  • POST /api/auth/login
    • Request Body:
      {
        "username": "exampleUser",
        "password": "examplePassword"
      }
    • Response:
      {
        "token": "your_jwt_token"
      }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors