https://github.com/jongan69/springboot-books
a demo java springboot api for managing a library
https://github.com/jongan69/springboot-books
Last synced: 2 months ago
JSON representation
a demo java springboot api for managing a library
- Host: GitHub
- URL: https://github.com/jongan69/springboot-books
- Owner: jongan69
- License: apache-2.0
- Created: 2024-04-25T20:23:41.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-27T21:11:36.000Z (about 2 years ago)
- Last Synced: 2025-01-09T17:17:55.121Z (over 1 year ago)
- Language: Java
- Homepage: https://security.grayfield-70b52b76.eastus.azurecontainerapps.io/swagger-ui/index.html
- Size: 121 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spring Boot 3.0 Library with Security with JWT Implementation
This project demonstrates the implementation of security using Spring Boot 3.0 and JSON Web Tokens (JWT). It includes the following features:
## Features
* User registration and login with JWT authentication
* Password encryption using BCrypt
* Role-based authorization with Spring Security
* Customized access denied handling
* Logout mechanism
* Refresh token
## Technologies
* Spring Boot 3.0
* Spring Security
* JSON Web Tokens (JWT)
* BCrypt
* Maven
## Getting Started
To get started with this project, you will need to have the following installed on your local machine:
* JDK 17+
* Maven 3+
To build and run the project, follow these steps:
* Clone the repository: `git clone`
* Navigate to the project directory: cd backend
* Create SQL Server in Azure and use `cp .env.example .env` and enter the sql server details
* Run `export $(cat .env | xargs)` in terminal to put .env variables in shell
* Build the project: `mvn clean install`
* Run the project: `mvn spring-boot:run`
## Steps for Azure Deployment
* To Prepare for azure deploy:
`export MAVEN_OPTS="--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED" ./mvnw com.microsoft azure:azure-spring-apps-maven-plugin:1.18.0:config -DadvancedOptions`
* To Deploy to azure:
`./mvnw azure-spring-apps:deploy`
### Azure Github Action
* Deploy with Github Action You need Azure creds in github env
1. With Azure CLI installed run
`az ad sp create-for-rbac \
--role contributor \
--scopes /subscriptions//resourceGroups/ \
--json-auth`
2. Set .env variable in github.com:
`AZURE_CREDENTIALS`: `Copy and paste above output`
-> The application will be available at http://localhost:8080.