Spring Boot, Spring Security, PostgreSQL: JWT Authentication & Authorization example
- stars
- 193
- watchers
- 3
- forks
- 78
- open issues
- 3
- Last updated
- 02/04/2024
Spring Boot, Spring Security, PostgreSQL: JWT Authentication & Authorization example
The diagram shows flow of how we implement User Registration, User Login and Authorization process.
You can have an overview of our Spring Boot Server with the diagram below:
Open src/main/resources/application.properties
spring.datasource.url= jdbc:postgresql://localhost:5432/testdb
spring.datasource.username= postgres
spring.datasource.password= 123
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto= update
# App Properties
bezkoder.app.jwtSecret= ======================BezKoder=Spring===========================
bezkoder.app.jwtExpirationMs= 86400000
mvn spring-boot:run
INSERT INTO roles(name) VALUES('ROLE_USER');
INSERT INTO roles(name) VALUES('ROLE_MODERATOR');
INSERT INTO roles(name) VALUES('ROLE_ADMIN');
For more detail, please visit:
Spring Boot, Spring Security, PostgreSQL: JWT Authentication & Authorization example
For instruction: Spring Boot Refresh Token with JWT example
Exception handling: @RestControllerAdvice example in Spring Boot
Validation: Spring Boot Validate Request Body
Documentation: Spring Boot and Swagger 3 example
Caching: Spring Boot Redis Cache example
Associations:
Run both Back-end & Front-end in one place: