I have created an Elastic Beanstalk web app that uses Amazon Cognito and its user pool and Hosted UI for sign-in before the user can reach a page with the form. I currently have my own domain and SSL certificate for the app so the sign-in can be done via a secure connection. The issue is that the YAML file needed to use Amazon Cognito gives me this error:

Failed to bind properties under 'spring.security.oauth2.client.registration.clientsecret' to org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties$Registration:
    Reason: No converter found capable of converting from type [java.lang.String] to type [org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties$Registration]

The YAML file structure looks like this:

spring:
  security:
    oauth2:
      client:
        registration:
          cognito:
          clientId: 47earg9gbo****
          clientSecret: bbvgpirvegmnr4gp4sunmp****
          scope: openid, email, aws.cognito.signin.user.admin, phone
          redirectUriTemplate: https://authorise.student.co.uk
          clientName: spring-boot
    provider:
      cognito:
        issuerUri: https://cognito-idp.eu-west-2.amazonaws.com/eu-west-2_BnR5***

What I have done to try to fix this issue was recreated the whole user pool for Amazon Cognito and update the configuration of the pom.xml (<--spring has proposed this in the error message) file that looks as such:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>StudentCognito</groupId>
    <artifactId>StudentCognito</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        <relativePath/>
    </parent>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>2.16.29</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <!--CORE-->
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>dynamodb-enhanced</artifactId>
            <version>2.11.0-PREVIEW</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>dynamodb</artifactId>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>sns</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-oauth2-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${project.parent.version}</version>
            </plugin>
        </plugins>
    </build>
</project>
0

There are 0 answers