gpt4 book ai didi

grails - 使用Spring Security Rest插件时从GitHub接收弃用警告

转载 作者:行者123 更新时间:2023-12-02 15:40:49 25 4
gpt4 key购买 nike

我有一个Grails 3应用程序,该应用程序使用spring-security-rest插件版本2.0.0.RC1,使用GitHub进行用户身份验证。

我从GitHub看到警告:

Your application used an access token as part of a query parameter to access an endpoint through the GitHub API:
https://api.github.com/user
Please use the Authorization HTTP header instead as using the `access_token` query parameter is deprecated.

是否有固定版本可以在Grails 3上使用?

我相信弃用警告会在2020年11月失效。

更新:戳pac4j我在OAuthConfiguration类中看到有一个tokenAsHeader变量。如果设置,则在获取用户信息时将授权 token 添加到 header 中。

我不确定这是否行得通,但我向application.groovy添加了tokenAsHeader = true:
github {
client = org.pac4j.oauth.client.GitHubClient
key = '${APP_KEY}'
secret = '${APP_SECRET}'
scope = 'user'
tokenAsHeader = true
defaultRoles = ['ROLE_GITHUB']
}

我没有看到调试输出中的更改,并且我只会定期收到不推荐使用的警告电子邮件,因此我不确定这是否是解决方案。

最佳答案

如您所知,OAuth客户端不是Spring Security REST本身的一部分,而是来自Pac4j。 Spring Security REST 2.0.0.RC1附带了2.5年的Pac4j 2.2.1。因此,如今不建议使用那时的客户端有效设置。

您的机会是:

  • 在本地升级到较新的Pac4j版本。它应该可以一直顺利升级到4.0.0。在build.gradle中:
    compile("org.grails.plugins:spring-security-rest:2.0.0.RC1") {
    exclude group: 'org.pac4j'
    }
    compile "org.pac4j:pac4j-core:3.8.3"
    compile "org.pac4j:pac4j-oauth:3.8.3"
  • 将应用程序升级到Grails 4并使用Spring Security REST 3.0.1,后者使用pac4j 3.8.3
  • 关于grails - 使用Spring Security Rest插件时从GitHub接收弃用警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61664862/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com