SpringBoot + AWS cognito,无法解析issuerUri

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

我想使用 AWS cognito 进行授权创建一个示例 Spring Boot 应用程序。我遵循了几个教程,但总是以相同的错误结束。

当我运行应用程序时,我得到:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Unsatisfied dependency expressed through field 'httpSecurity': Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.HttpSecurityConfiguration': Unsatisfied dependency expressed through method 'setContentNegotiationStrategy' parameter 0: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setAuthorizedClientManager' parameter 0: Error creating bean with name 'OAuth2AuthorizedClientManager': Failed to instantiate [org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager]: Factory method 'getAuthorizedClientManager' threw exception with message: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]:Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception with message: Unable to resolve Configuration with the provided Issuer of "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_9EmaXexYM/.well-known/openid-configuration"

这在我看来很奇怪,因为当我直接在浏览器中访问 URL https://cognito-idp.us-east-1.amazonaws.com/us-east-1_9EmaXexYM/.well-known/openid-configuration ,我收到包含所有信息的回复。可能是什么问题?

我的应用程序.yml:

spring:
  security:
    oauth2:
      client:
        registration:
          cognito:
            clientName: SpringBootApp
            client-secret: 11iflp3rhfuj9veomalbsvoi5url4vhu3r39in5l1jo0btsac48s
            redirect-uri: 'http://localhost:8080/login/oauth2/code/cognito'
            client-id: 3ai0tn07c5smcn00d963670rsf
            scope: openid
            authorization-grant-type: authorization_code
        provider:
          cognito:
            issuerUri: https://cognito-idp.us-east-1.amazonaws.com/us-east-1_9EmaXexYM/.well-known/openid-configuration
java amazon-web-services spring-boot oauth-2.0 amazon-cognito
1个回答
0
投票

查看讨论此主题的 AWS 教程。我上次经历过它,它起作用了。

使用 Amazon Cognito 要求用户登录 Web 应用程序

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