- Notifications
You must be signed in to change notification settings - Fork139
bezkoder/spring-boot-login-example
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Build a Spring Boot Login and Registration example (Rest API) that supports JWT with HttpOnly Cookie. You’ll know:
- Appropriate Flow for User Login and Registration with JWT and HttpOnly Cookies
- Spring Boot Rest Api Architecture with Spring Security
- How to configure Spring Security to work with JWT
- How to define Data Models and association for Authentication and Authorization
- Way to use Spring Data JPA to interact with MySQL Database
You can have an overview of our Spring Boot Server with the diagram below:
For more detail, please visit:
Working with Front-end:
Angular 12 /Angular 13 /Angular 14 /Angular 15 /Angular 16 /Angular 17
– 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.jwtCookieName= bezkoderbezkoder.app.jwtSecret= ======================BezKoder=Spring===========================bezkoder.app.jwtExpirationMs= 86400000- For MySQL
spring.datasource.url= jdbc:mysql://localhost:3306/testdb?useSSL=falsespring.datasource.username= rootspring.datasource.password= 123456spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialectspring.jpa.hibernate.ddl-auto= update# App Propertiesbezkoder.app.jwtCookieName= bezkoderbezkoder.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');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:
Deployment:
Run both Back-end & Front-end in one place:
About
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example
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.

