From 57ec69ad3b45a3d1f1431231c8c2b9deb1c00a3e Mon Sep 17 00:00:00 2001 From: Adrian Precub Date: Wed, 8 May 2019 17:26:17 +0300 Subject: [PATCH] BAEL-2587: create separate module for cognito (#6814) * BAEL-2587: create separate module for cognito * BAEL-2587: add separate module for cognito in parent pom * BAEL-2587: remove cognito from spring-5-security-oauth module and correct pom.xml * BAEL-2587: replace tabs with spaces in pom.xml to fix indentation * BAEL-2587: fix pom indentation * BAEL-2587: fix article link --- pom.xml | 4 +- spring-5-security-cognito/README.md | 3 + spring-5-security-cognito/pom.xml | 74 +++++++++++++++++++ .../cognito/CognitoWebConfiguration.java | 2 +- .../cognito/SpringCognitoApplication.java | 2 +- .../resources/cognito/application-cognito.yml | 0 .../src/main/resources/cognito/home.html | 0 .../src/main/resources/cognito/style.css | 0 .../src/main/resources/logback.xml | 13 ++++ 9 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 spring-5-security-cognito/README.md create mode 100644 spring-5-security-cognito/pom.xml rename {spring-5-security-oauth => spring-5-security-cognito}/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java (91%) rename {spring-5-security-oauth => spring-5-security-cognito}/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java (88%) rename spring-5-security-oauth/src/main/resources/cognito/application_cognito.yml => spring-5-security-cognito/src/main/resources/cognito/application-cognito.yml (100%) rename {spring-5-security-oauth => spring-5-security-cognito}/src/main/resources/cognito/home.html (100%) rename {spring-5-security-oauth => spring-5-security-cognito}/src/main/resources/cognito/style.css (100%) create mode 100644 spring-5-security-cognito/src/main/resources/logback.xml diff --git a/pom.xml b/pom.xml index 89c9416ebb82..2ea5e4505c83 100644 --- a/pom.xml +++ b/pom.xml @@ -608,6 +608,7 @@ spring-5-reactive-security spring-5-security spring-5-security-oauth + spring-5-security-cognito spring-activiti spring-akka @@ -819,6 +820,7 @@ spring-5-reactive-security spring-5-security spring-5-security-oauth + spring-5-security-cognito spring-activiti spring-akka spring-all @@ -1271,7 +1273,7 @@ spring-5-reactive-security spring-5-security spring-5-security-oauth - + spring-5-security-cognito spring-activiti spring-akka spring-all diff --git a/spring-5-security-cognito/README.md b/spring-5-security-cognito/README.md new file mode 100644 index 000000000000..0825882c0559 --- /dev/null +++ b/spring-5-security-cognito/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Authenticating with Amazon Cognito Using Spring Security](https://www.baeldung.com/spring-security-oauth-cognito) diff --git a/spring-5-security-cognito/pom.xml b/spring-5-security-cognito/pom.xml new file mode 100644 index 000000000000..c7314d6f9fbd --- /dev/null +++ b/spring-5-security-cognito/pom.xml @@ -0,0 +1,74 @@ + + 4.0.0 + com.baeldung + spring-5-security-cognito + 0.0.1-SNAPSHOT + spring-5-security-cognito + jar + spring 5 security oauth cognito sample project + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity5 + + + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + ${oauth-auto.version} + + + org.springframework.security + spring-security-oauth2-client + + + org.springframework.security + spring-security-oauth2-jose + + + + org.springframework + spring-test + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + + + 2.1.0.RELEASE + 2.1.0.RELEASE + com.baeldung.cognito.SpringCognitoApplication + + + diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java similarity index 91% rename from spring-5-security-oauth/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java rename to spring-5-security-cognito/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java index ae03e0a802c0..6841fa7a6537 100644 --- a/spring-5-security-oauth/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java +++ b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java @@ -6,7 +6,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration -@PropertySource("cognito/application_cognito.yml") +@PropertySource("cognito/application-cognito.yml") public class CognitoWebConfiguration implements WebMvcConfigurer { @Override diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java similarity index 88% rename from spring-5-security-oauth/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java rename to spring-5-security-cognito/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java index 7f7b751cd94c..eebe6d8f4595 100644 --- a/spring-5-security-oauth/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java +++ b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java @@ -5,7 +5,7 @@ import org.springframework.context.annotation.PropertySource; @SpringBootApplication -@PropertySource("cognito/application_cognito.yml") +@PropertySource("cognito/application-cognito.yml") public class SpringCognitoApplication { public static void main(String[] args) { diff --git a/spring-5-security-oauth/src/main/resources/cognito/application_cognito.yml b/spring-5-security-cognito/src/main/resources/cognito/application-cognito.yml similarity index 100% rename from spring-5-security-oauth/src/main/resources/cognito/application_cognito.yml rename to spring-5-security-cognito/src/main/resources/cognito/application-cognito.yml diff --git a/spring-5-security-oauth/src/main/resources/cognito/home.html b/spring-5-security-cognito/src/main/resources/cognito/home.html similarity index 100% rename from spring-5-security-oauth/src/main/resources/cognito/home.html rename to spring-5-security-cognito/src/main/resources/cognito/home.html diff --git a/spring-5-security-oauth/src/main/resources/cognito/style.css b/spring-5-security-cognito/src/main/resources/cognito/style.css similarity index 100% rename from spring-5-security-oauth/src/main/resources/cognito/style.css rename to spring-5-security-cognito/src/main/resources/cognito/style.css diff --git a/spring-5-security-cognito/src/main/resources/logback.xml b/spring-5-security-cognito/src/main/resources/logback.xml new file mode 100644 index 000000000000..7d900d8ea884 --- /dev/null +++ b/spring-5-security-cognito/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file