Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hantsy/spring-webmvc-jwt-sample
Secures REST APIs with Spring Security and JWT Token based Authentication
https://github.com/hantsy/spring-webmvc-jwt-sample
jwt spring spring-boot spring-data-jpa spring-data-rest spring-security
Last synced: 13 days ago
JSON representation
Secures REST APIs with Spring Security and JWT Token based Authentication
- Host: GitHub
- URL: https://github.com/hantsy/spring-webmvc-jwt-sample
- Owner: hantsy
- License: gpl-3.0
- Created: 2018-04-25T11:48:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T14:49:44.000Z (15 days ago)
- Last Synced: 2024-10-28T17:28:46.532Z (15 days ago)
- Topics: jwt, spring, spring-boot, spring-data-jpa, spring-data-rest, spring-security
- Language: Java
- Homepage: https://medium.com/zero-equals-false/protect-rest-apis-with-spring-security-and-jwt-5fbc90305cc5
- Size: 274 KB
- Stars: 491
- Watchers: 22
- Forks: 222
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spring-webmvc-jwt-sample
![build](https://github.com/hantsy/spring-webmvc-jwt-sample/workflows/build/badge.svg)
## What is this?
This is a sample project demos how to use JWT token based authentication to protect the RESTful APIs in a Spring WebMVC application.
> If you are interested in the new variant built with the Spring WebFlux stack, check [spring-reactive-jwt-sample](https://github.com/hantsy/spring-reactive-jwt-sample/) for more details.
## Guide
Check the [step-by-step GUIDE](./GUIDE.md) to get the detailed explanation of the example codes.
> The original codes were written in Spring Boot 2.0, there are some slightly difference in the main/master branch due to the changes brought in the latest Spring Boot 3.0.
## Prerequisites
Make sure you have installed the following software.
* Java 17
* Apache Maven 3.6.x
* Docker## Build
Clone the source codes from Github.
```bash
git clone https://github.com/hantsy/spring-webmvc-jwt-sample
```Open a terminal, and switch to the root folder of the project, and run the following command to build the whole project.
```bash
docker-compose up postgres // start up a postgres
mvn clean install // build the project
```Run the application.
```bash
mvn spring-boot:run
// or from command line after building
java -jar target/xxx.jar
```## Contribution
Any suggestions are welcome, filing an issue or submitting a PR is also highly recommended.