https://github.com/charlybutar21/spring-boot-security-jwt-authentication
Spring Boot application to implement rest API with JWT authentication
https://github.com/charlybutar21/spring-boot-security-jwt-authentication
api-integration junit jwt-authentication mysql rest-api solid-principles spring-boot spring-data-jpa spring-mvc spring-security-jwt spring-validation
Last synced: about 2 months ago
JSON representation
Spring Boot application to implement rest API with JWT authentication
- Host: GitHub
- URL: https://github.com/charlybutar21/spring-boot-security-jwt-authentication
- Owner: charlybutar21
- Created: 2023-07-20T13:13:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-21T14:51:47.000Z (almost 3 years ago)
- Last Synced: 2025-10-25T18:35:20.601Z (7 months ago)
- Topics: api-integration, junit, jwt-authentication, mysql, rest-api, solid-principles, spring-boot, spring-data-jpa, spring-mvc, spring-security-jwt, spring-validation
- Language: Java
- Homepage:
- Size: 101 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Boot JWT Authentication example with Spring Security & Spring Data JPA
## User Registration, User Login and Authorization process.
The diagram shows flow of how we implement User Registration, User Login and Authorization process.

## Configure Spring Datasource, JPA, App properties
Open `src/main/resources/application.properties`
- MySQL
```
spring.datasource.url=jdbc:mysql://localhost:3306/demo_db?useSSL=false
spring.datasource.username=root
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=update
# App Properties
bezkoder.app.jwtSecret= ======================BezKoder=Spring===========================
bezkoder.app.jwtExpirationMs=86400000
```
## Run Spring Boot application
```
mvn spring-boot:run
```
## Run following SQL insert statements
Open `database.sql`
```
INSERT INTO roles(name) VALUES('ROLE_USER');
INSERT INTO roles(name) VALUES('ROLE_MODERATOR');
INSERT INTO roles(name) VALUES('ROLE_ADMIN');
```