spring-webmvc-jwt-sample

利用 Spring Security 和基于 JWT 令牌的身份验证确保 REST API 的安全。「Secures REST APIs with Spring Security and JWT Token based Authentication」

Github星跟蹤圖

spring-webmvc-jwt-sample

build

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 for more details.

Guide

Check the step-by-step GUIDE 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 2.4.

Prerequisites

Make sure you have installed the following software.

  • Java 11
  • Apache Maven 3.6.x
  • Docker

Build

Clone the source codes from Github.

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.

docker-compose up postgres // start up a postgres
mvn clean install // build the project

Run the application.

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.

主要指標

概覽
名稱與所有者hantsy/spring-webmvc-jwt-sample
主編程語言Java
編程語言Java (語言數: 1)
平台
許可證GNU General Public License v3.0
所有者活动
創建於2018-04-25 11:48:35
推送於2025-03-31 14:48:11
最后一次提交2025-03-31 14:48:09
發布數0
用户参与
星數490
關注者數21
派生數225
提交數151
已啟用問題?
問題數11
打開的問題數0
拉請求數62
打開的拉請求數0
關閉的拉請求數1
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?