从 Spring Boot Oauth2 迁移到 Spring Security 5 [英] Migrating from Spring Boot Oauth2 to Spring Security 5

查看:97
本文介绍了从 Spring Boot Oauth2 迁移到 Spring Security 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我使用 Spring Boot OAuth2 来授权在我的项目中正确使用 OAuth2,所以我有以下内容:

Today I'm using Spring Boot OAuth2 to grant correct use of OAuth2 in my project, so I have the following:

  1. 我有 API A 调用 API B
  2. API A 生成 JWT Token 并调用 API B.
  3. API B 使用两种方式验证 JWT 令牌:在线(自省)和离线(使用 RSA 密钥).

因此,迁移到 Spring Security 5 时遇到了以下问题:

So, migrating to Spring Security 5 I got the following problems:

  1. 我没有找到任何样本(https://github.com/spring-projects/spring-security/tree/master/samples/boot) 使用 Spring Cloud OpenFeign.我所有的项目都使用它 (Feing) 并且更改为 Spring WebClient 可能会很成问题.
  2. 文档只谈 WebClient (https://docs.spring.io/spring-security/site/docs/current/reference/html5/#oauth2client),与 RestTemplate 或 Feign 无关.
  1. I didn't found any samples (https://github.com/spring-projects/spring-security/tree/master/samples/boot) using Spring Cloud OpenFeign. All my project use it (Feing) and change to Spring WebClient can be very problematic.
  2. Documentation just talk about WebClient (https://docs.spring.io/spring-security/site/docs/current/reference/html5/#oauth2client), nothing about RestTemplate or Feign.

推荐答案

Joe Grandja 写了一个 OAuth2应用程序和相应迁移的 Spring Security 应用程序.

Joe Grandja wrote an OAuth2 application and the corresponding migrated Spring Security application.

您可以在此处查看示例:

You can check the examples here:

Spring Security OAuth 2.4 迁移示例

此外,有关配置 Spring Security 的文档在这里:

Also, docs about configuring Spring Security are here:

OAuth2.0 资源服务器

这篇关于从 Spring Boot Oauth2 迁移到 Spring Security 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆