Spring 没有 OAuth 的安全 JWT

Spring security JWT without OAuth

最近我开始学习如何使用oauth 2.0 + jwt配置spring启动,我有一个问题:是否可以使用spring boot security + jwt避免oauth 2.0?

是的,可以在不使用标准化 OAuth 2.0 流程的情况下使用 JWT 功能。 Here is a good example implementation to help you out. Another example can be found at AUTH0。例如,您可以使用此依赖项:

<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-jwt -->
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-jwt</artifactId>
    <version>1.0.9.RELEASE</version>
</dependency>