使用 Java 配置的 Spring OAuth2 的最简单示例是什么?

What is the simplest example of Spring OAuth2 with Java configuration?

我最近在 Spring 中构建了一个 REST API,我正在使用 .Net C# 客户端。目前没有安全措施,所以我想实施 OAuth2。我将成为我的 REST API 的唯一用户,所以我不需要复杂的东西。 Spring Security OAuth2 的某个地方是否有一个带有 java 配置的简单示例?我查看了很多地方,但这些示例要么使用 xml,要么它们太旧且过时,或者对于我需要的东西来说太复杂了。我将不胜感激。

顺便说一下,我查看了 Sparklr 教程和 github 存储库,但它们似乎太复杂了,无法满足我的需要。

您看到 spring 项目的示例了吗?

https://github.com/spring-projects/spring-security-oauth/tree/master/samples

下面的项目在 server/client 方面提供了一个很好的例子。

https://github.com/bassemZohdy/Spring_REST_OAuth_Demo

希望对您有所帮助。

这是我找到的最好的 https://github.com/spring-projects/spring-security-oauth/tree/master/tests/annotation