Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rapter1990/springbootsecurity
Spring Boot Security Example (Spring Boot, Java 17, Spring Security, Docker, Maven, JUnit Test, Integration Test, Test Container, MySql)
https://github.com/rapter1990/springbootsecurity
authentication authorization docker docker-compose dockerfile intergration-test java java17 junit jwt lombok maven mockito monolith mysql spring-boot spring-security test-container
Last synced: about 3 hours ago
JSON representation
Spring Boot Security Example (Spring Boot, Java 17, Spring Security, Docker, Maven, JUnit Test, Integration Test, Test Container, MySql)
- Host: GitHub
- URL: https://github.com/rapter1990/springbootsecurity
- Owner: Rapter1990
- Created: 2024-03-17T11:27:49.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-03T19:24:10.000Z (8 months ago)
- Last Synced: 2024-04-25T04:11:59.005Z (7 months ago)
- Topics: authentication, authorization, docker, docker-compose, dockerfile, intergration-test, java, java17, junit, jwt, lombok, maven, mockito, monolith, mysql, spring-boot, spring-security, test-container
- Language: Java
- Homepage:
- Size: 6.13 MB
- Stars: 16
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Boot with Spring Security through JWT Implementation
### 📖 Information
-
It is a kind of Spring Boot example with covering important and useful features - Here is the explanation of the example
Admin and User implement their own authentication and authorization through their defined role name
Admin handles with creating product, getting all products, getting product by Id, updating product by Id and lastly deleting product by Id
Admin only handles with getting all products and getting product by Id
### Explore Rest APIs
Method
Url
Description
Request Body
Header
Valid Path Variable
No Path Variable
POST
/api/v1/authentication/admin/register
Admin Register
AdminRegisterRequest
POST
/api/v1/authentication/admin/login
Admin Login
LoginRequest
POST
/api/v1/authentication/admin/refreshtoken
Admin Refresh Token
TokenRefreshRequest
POST
/api/v1/authentication/admin/logout
Admin Logout
TokenInvalidateRequest
POST
/api/v1/authentication/user/register
User Register
UserRegisterRequest
POST
/api/v1/authentication/user/login
User Login
LoginRequest
POST
/api/v1/authentication/user/refreshtoken
User Refresh Token
TokenRefreshRequest
POST
/api/v1/authentication/user/logout
User Logout
TokenInvalidateRequest
POST
/api/v1/products
Create Product
ProductCreateRequest
GET
/api/v1/products/{productId}
Get Product By Id
ProductId
GET
/api/v1/products
Get Products
ProductPagingRequest
PUT
/api/v1/products/{productId}
Update Product By Id
ProductUpdateRequest
ProductId
DELETE
/api/v1/products/{productId}
Delete Product By Id
ProductId
### Technologies
---
- Java 17
- Spring Boot 3.0
- Restful API
- Lombok
- Maven
- Junit5
- Mockito
- Integration Tests
- Docker
- Docker Compose
### Prerequisites
#### Define Variable in .env file
```
DATABASE_USERNAME={DATABASE_USERNAME}
DATABASE_PASSWORD={DATABASE_PASSWORD}
```
---
- Maven or Docker
---
### Docker Run
The application can be built and run by the `Docker` engine. The `Dockerfile` has multistage build, so you do not need to build and run separately.
Please follow directions shown below in order to build and run the application with Docker Compose file;
```sh
$ cd springbootsecurity
$ docker-compose up -d
```
If you change anything in the project and run it on Docker, you can also use this command shown below
```sh
$ cd springbootsecurity
$ docker-compose up --build
```
---
### Maven Run
To build and run the application with `Maven`, please follow the directions shown below;
```sh
$ cd springbootsecurity
$ mvn clean install
$ mvn spring-boot:run
```
### Screenshots
Click here to show the screenshots of project
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11
Figure 12
Figure 13
Figure 14
Figure 15
Figure 16