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:
For more detail, please visit:
Secure Spring Boot App with Spring Security & JWT Authentication For MongoDB
For instruction: Spring Boot Refresh Token with JWT example
Spring Boot + Vue.js JWT Authentication Spring Boot + Angular 8 JWT Authentication Spring Boot + Angular 10 JWT Authentication Spring Boot + Angular 11 JWT Authentication Spring Boot + React JWT Authentication
Vue.js + Spring Boot + MySQL/PostgreSQL example Angular 8 + Spring Boot + MySQL example Angular 8 + Spring Boot + PostgreSQL example Angular 10 + Spring Boot + MySQL example Angular 10 + Spring Boot + PostgreSQL example Angular 11 + Spring Boot + MySQL example Angular 11 + Spring Boot + PostgreSQL example React + Spring Boot + MySQL example React + Spring Boot + PostgreSQL example React + Spring Boot + MongoDB example Run both Back-end & Front-end in one place: Integrate Angular with Spring Boot Rest API Integrate React.js with Spring Boot Rest API Integrate Vue.js with Spring Boot Rest API More Practice: Spring Boot File upload example with Multipart File Exception handling: @RestControllerAdvice example in Spring Boot Spring Boot Repository Unit Test with @DataJpaTest Deploy Spring Boot App on AWS – Elastic Beanstalk Secure Spring Boot App with Spring Security & JWT Authentication
– If you want to use PostgreSQL:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
– or MySQL:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
Open src/main/resources/application.properties
- For PostgreSQL:
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= bezKoderSecretKey
bezkoder.app.jwtExpirationMs= 86400000
- For MySQL
spring.datasource.url= jdbc:mysql://localhost:3306/testdb?useSSL=false
spring.datasource.username= root
spring.datasource.password= 123456
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto= update
# App Properties
bezkoder.app.jwtSecret= bezKoderSecretKey
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');