如何使用 jwt 公钥在 Spring Boot 中验证承载访问令牌

Posted

技术标签:

【中文标题】如何使用 jwt 公钥在 Spring Boot 中验证承载访问令牌【英文标题】:How to validate bearer access token in spring boot using jwt public key 【发布时间】:2020-01-18 16:36:06 【问题描述】:

我有使用客户端 ID 和密码从 websec 生成的访问令牌。

我的项目 app.properties 有 jwt 公钥。

我正在开发 rest api ,调用 Rest api 将提供我想使用 jwt 公钥验证的 Bear 令牌(生成一个)。

但是 spring security 在内部使用内存令牌验证器并返回无效令牌。

那么我如何使用 jwt 公钥来验证承载令牌。

或者在这里我缺乏一些理解。

【问题讨论】:

看看这篇关于 Spring Boot + JWT 的精彩文章:dzone.com/articles/… 【参考方案1】:

看这里你会清楚地知道如何使用 Spring Security 验证令牌。 https://www.devglan.com/spring-security/spring-boot-jwt-auth

【讨论】:

以上是关于如何使用 jwt 公钥在 Spring Boot 中验证承载访问令牌的主要内容,如果未能解决你的问题,请参考以下文章

在 Spring Boot 安全性中使用公钥/私钥创建和验证 JWT 签名

Spring Boot 整合 JWT

Spring Boot 鉴权之—— JWT 鉴权

Spring Boot 安全性 + JWT

Spring Cloud Security JWT:使用配置服务器/密钥轮换分发公钥

Spring Cloud Security JWT:使用配置服务器/密钥轮换分发公钥