本地主机的Spring Security redirectUri使用https代替http

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

我已经使用Spring Security来实现我的oauth2客户端。我已将回调配置为http://localhost:8080/login/oauth2/code/abc,所以当我在本地环境中测试应用时,回调将转到https://localhost:8080/login/oauth2/code/abc,因为https对本地主机无效,因此浏览器抛出错误,因此无法测试申请表

spring:
      profiles: local
      security:
        oauth2:
          client:
            registration:
              abc:
                client-id: OTExZDE3MGQtZTkyMy00YWZjLWFhZDItMGVmZTI1ZDQ3MGJm
                client-secret: MzNlZWFhNDQtOGE4Mi00NDVkLWFiMTUtZjAzNWE2YmU2YWIz
                authorization-grant-type: authorization_code
                redirectUri: http://localhost:3000/login/oauth2/code/abc
                scope:
                  - openid
                  - internal
            provider:
              abc:
                authorization-uri: https://api.abc.com/oauth/authorize
                token-uri: https://api.abc.com/oauth/token
                jwk-set-uri: https://api.abc.com/oauth/keys
spring oauth oauth-2.0 spring-security-oauth2 google-login
1个回答
0
投票

此配置如何?

security.oauth2.client.use-current-uri=false

AbstractRedirectResourceDetails.isUseCurrentUri()的JavaDoc如下。

标记,表示应优先使用请求中的当前URI(如果已设置),而不是预先建立的重定向URI。

© www.soinside.com 2019 - 2024. All rights reserved.