Skip to content

Authentication API - The API demonstrate how to configure Authentication and Authorization in Spring application using Spring Security.

Notifications You must be signed in to change notification settings

jonasfschuh/auth-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Authentication API

Java Spring MySQL JWT IntelliJ IDEA Postman

This project is an API built using Java, Java Spring, MySQL as the database, and Spring Security and JWT for authentication control.

The API demonstrate how to configure Authentication and Authorization in Spring application using Spring Security.

Table of Contents

Installation

  1. Clone the repository:
git clone https://github.com/kenzor1979/auth-api.git
  1. Install dependencies with Maven

  2. Install MySQL

Usage

  1. Start the application with Maven
  2. The API will be accessible at http://localhost:8080

API Endpoints

The API provides the following endpoints:

GET /product - Retrieve a list of all products. (all authenticated users)

POST /product - Register a new product (ADMIN access required).

POST /auth/login - Login into the App

POST /auth/register - Register a new user into the App

Authentication

The API uses Spring Security for authentication control. The following roles are available:

USER -> Standard user role for logged-in users.
ADMIN -> Admin role for managing partners (registering new partners).

To access protected endpoints as an ADMIN user, provide the appropriate authentication credentials in the request header.

Authorization type is Bearer Token.

Database

The project utilizes MySQL as the database.

It is necessary to create a schema named "auth" or change the schema name in the "application.properties" file.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the repository.

When contributing to this project, please follow the existing code style, commit conventions, and submit your changes in a separate branch.

Screenshots

Register as Admin Role Register as Admin

Register as User Role Register as User

Login Login

Authorization Authorization

Post post

MySQL table products MySQL products

MySQL table users MySQL users

About

Authentication API - The API demonstrate how to configure Authentication and Authorization in Spring application using Spring Security.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages