spring-security-refresh-token-jwt
spring-security-refresh-token-jwt copied to clipboard
Spring Security Refresh Token using JWT in Spring Boot example with HttpOnly Cookie - Expire and Renew JWT Token
Spring Security Refresh Token with JWT in Spring Boot example
Build JWT Refresh Token with Spring Security in the Spring Boot Application. You can know how to expire the JWT Token, then renew the Access Token with Refresh Token in HttpOnly Cookie.
The instruction can be found at: Spring Security Refresh Token with JWT
User Registration, User Login and Authorization process.
The diagram shows flow of how we implement User Registration, User Login and Authorization process.

And this is for Refresh Token:

Configure Spring Datasource, JPA, App properties
Open src/main/resources/application.properties
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.MySQLDialect
spring.jpa.hibernate.ddl-auto= update
# App Properties
bezkoder.app.jwtSecret= bezKoderSecretKey
bezkoder.app.jwtExpirationMs= 3600000
bezkoder.app.jwtRefreshExpirationMs= 86400000
Run Spring Boot application
mvn spring-boot:run
Run following SQL insert statements
INSERT INTO roles(name) VALUES('ROLE_USER');
INSERT INTO roles(name) VALUES('ROLE_MODERATOR');
INSERT INTO roles(name) VALUES('ROLE_ADMIN');
Related Posts:
Spring Boot, Spring Security: JWT Authentication & Authorization example
More Practice:
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:
Deployment:
Fullstack Authentication
Fullstack CRUD App
Run both Back-end & Front-end in one place:
More Practice:
Exception handling: @RestControllerAdvice example in Spring Boot
Associations:
Deployment: