迁移到 spring security 6 后验证错误 - (缺少 client_secret)

问题描述 投票:0回答:0

我一直在将我的微服务迁移到 Springboot 3.0.2,现在我必须使用 spring security 版本 6,但是当请求在后台将请求主体构建到 OAuth Provider 时,我遇到了一个问题,当我看到日志我意识到字段 client_secret 被忘记了为什么 client_secret 在请求中丢失并且 Oauth Provider 返回 401 UNAUTHORIZED 原因:

Decoded [{error=true, type=invalid_client, message=Missing client_secret parameter, details={name=OAuth2Error, message=Missing client_secret parameter, headers={WWW-Authenticate=Basic realm="Service"}, code=401, error=invalid_client, error_description=Missing client_secret parameter}}]

重要的是,在迁移到 spring security 6 之前,换句话说,当我使用 spring securty 5.X 时它运行成功!

  1. I saw the application can retrieve the values from enviroment variables.

  2. This log shows that field client_secret was ignored.

  3. Here we can see a successfully request by previous spring security version, the field client_secret was present.

  4. Here is my spring configuration

  5. This is my WebSecurityConfig

我尝试以多种方式重写 WebSecurityConfig,但没有一个有效。

spring spring-boot spring-security spring-security-oauth2 migrating
© www.soinside.com 2019 - 2024. All rights reserved.