Spring security 跳过Spring Boot OAuth2中的OAuth用户批准

Spring security 跳过Spring Boot OAuth2中的OAuth用户批准,spring-security,spring-security-oauth2,Spring Security,Spring Security Oauth2,我只是想知道是否有任何方法可以跳过SpringBoot-SpringSecurityOAuth2中的用户批准屏幕。我听说过自定义用户审批处理程序,但我不确定如何覆盖它以禁用用户审批流程并执行直接重定向 谢谢您不需要自定义处理程序来跳过审批(反正从2.0开始)。您只需将客户端详细信息中的autoApprove标志设置为“true”(或要自动批准的范围模式列表)。这就是我在JHipster应用程序中更改它的方式: @覆盖 公共无效配置(ClientDetailsServiceConfigurer客户

我只是想知道是否有任何方法可以跳过SpringBoot-SpringSecurityOAuth2中的用户批准屏幕。我听说过自定义用户审批处理程序,但我不确定如何覆盖它以禁用用户审批流程并执行直接重定向


谢谢

您不需要自定义处理程序来跳过审批(反正从2.0开始)。您只需将客户端详细信息中的
autoApprove
标志设置为“true”(或要自动批准的范围模式列表)。

这就是我在JHipster应用程序中更改它的方式:

@覆盖
公共无效配置(ClientDetailsServiceConfigurer客户端)引发异常{
客户
.inMemory()
.withClient(JHIPSterpreProperties.getSecurity().getAuthentication().getOauth().getClientid())
.autoApprove(true)
.作用域(“读”、“写”)
.authorities(AuthoritiesConstants.ADMIN、AuthoritiesConstants.USER)
.authorizedGrantTypes(“密码”、“刷新令牌”)
.secret(jhipsterpreProperties.getSecurity().getAuthentication().getOauth().getSecret())
.accessTokenValiditySeconds(JHIPSterpreProperties.getSecurity().getAuthentication().getOauth().GetTokenValiditySeconds());
}

在application.yml中设置属性自动批准作用域:'.*'

security:
  oauth2:
    client:
      client-id: acme
      client-secret: acmesecret
      scope: read,write
      auto-approve-scopes: '.*'

也请参见

有什么原因吗?我已将此表单返回到我的/authorize请求,我想禁用它,但我想知道它是否是安全和良好的解决方案!为了确保这一点更加清楚,请注意@Dave Syer在引文中的表述为true。如果要在数据库中存储客户端详细信息,则该值需要是数据库中的字符串,而不是布尔值true。这正是它工作的时间。不确定您的意思。他的意思是,如果您在数据库中存储客户机详细信息,则需要将autoapprove列值保存为'true'(字符串),而不是1(例如,对于true boolean,mysql默认值)