- Notifications
You must be signed in to change notification settings - Fork888
Spring Boot + Security: Token Based Authentication example with JWT, Authorization, Spring Data & MySQL
bezkoder/spring-boot-spring-security-jwt-authentication
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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:
– If you want to use PostgreSQL:
<dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>runtime</scope></dependency>
– or MySQL:
<dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> <scope>runtime</scope></dependency>
Opensrc/main/resources/application.properties
- For PostgreSQL:
spring.datasource.url= jdbc:postgresql://localhost:5432/testdbspring.datasource.username= postgresspring.datasource.password= 123spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= truespring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect# Hibernate ddl auto (create, create-drop, validate, update)spring.jpa.hibernate.ddl-auto= update# App Propertiesbezkoder.app.jwtSecret= bezKoderSecretKeybezkoder.app.jwtExpirationMs= 86400000- For MySQL
spring.datasource.url=jdbc:mysql://localhost:3306/testdb_spring?useSSL=falsespring.datasource.username=rootspring.datasource.password=123456spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialectspring.jpa.hibernate.ddl-auto=update# App Propertiesbezkoder.app.jwtSecret= ======================BezKoder=Spring===========================bezkoder.app.jwtExpirationMs=86400000mvn spring-boot:runINSERT 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:
Secure Spring Boot with Spring Security & JWT Authentication
For instruction:Spring Boot Refresh Token with JWT example
Spring Boot JWT Authentication example using HttpOnly Cookie
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:
Run both Back-end & Front-end in one place:
About
Spring Boot + Security: Token Based Authentication example with JWT, Authorization, Spring Data & MySQL
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.


