Skip to content

A Spring Boot project which filters request for a token to authenticate and authorize the users.

Notifications You must be signed in to change notification settings

nhtY/Token-Filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Filter App

My aim in this project is to understand servlet filters and how to manage token headers in the request and response headers. I had a chance to experience the Inversion Of Control principle and its implementation via Dependency Injection.

In this application, a simple token-based authentication and authorization method is adopted. The token contains expiration data and some unique random characters. There are a number of protected paths that require a valid token to be accessed. The existence of a valid token header is examined using two separate filters: token filter and authorization filter. token filter checks if token is not expired and exists in the database. After that, the authorization filter checks if the requested path or resources are allowed to be accessed by the requesting user. Furthermore, the application provides some other features such as CRUD for users and products.

The application has three main layers: repository for data access, service for business logic, and controller for handling restful HTTP requests. Besides these modules, it has config, filter, model, error, etc. Shortly, the application is split into modules for ease of development and separation of concerns.

So, Spring Data JPA, JdbcTemplate, Lombok, Servlet Filter are used.

Modules in the app:

image-20230824171726848

General view of the HTTP methods

image-20230824172134302

FRONTEND

The front end is developed using React. State management uses Redux Tool-Kit with asyncThunks. Axios is used for API calls. Bootstrap is used to make the design a bit attractive.

Landing page

image-20230824170608891

Login Page

image-20230824170526848

Register Page

image-20230824170642562

Profile

image-20230824170717859

Profile - Edit

image-20230824170751488

User Operations

image-20230824170946649

When opening user home page, if the token is expired, user is forced to log out automatically.

image-20230824171213557


About

A Spring Boot project which filters request for a token to authenticate and authorize the users.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published