問題描述
Spring Boot 2 Oauth 如何實現隱式代碼流 (Spring Boot 2 Oauth how to implement Implicit Code Flow)
目前我正在將 OAuth 引入我的 Spring 應用程序,但我沒有正確集成它的運氣。我正在使用 Spring Boot 2。
我的要求是:
- 授權和資源服務器是同一個應用程序在同一台服務器上運行
- 需要支持隱式、授權碼授予和資源所有者憑據授予流
- 我想在“ /api/v1/"
我很確定安全配置的某些東西搞砸了,但我不知道它能做什麼是。我在網上查看了很多指南,但我沒有找到一個解釋所有授權碼組合的指南。我認為這可能是驗證 URL 的一個小錯誤,但我不知道它可能是什麼。
如果有人知道這個問題的答案,我會非常高興。
我在網上查看了很多指南,但我沒有找到一個解釋所有授權碼組合的指南。我認為這可能是驗證 URL 的一個小錯誤,但我不知道它可能是什麼。如果有人知道這個問題的答案,我會非常高興。
我在網上查看了很多指南,但我沒有找到一個解釋所有授權碼組合的指南。我認為這可能是驗證 URL 的一個小錯誤,但我不知道它可能是什麼。如果有人知道這個問題的答案,我會非常高興。
參考解法
方法 1:
Move your configure() implementation from WebSecurityConfig to Resource Server configure() method as below
http.authorizeRequests()
.antMatchers("/api/v1/**")
.hasAnyRole("ADMIN", "USER")
Rest of the configurations in configure() method are not required