diff --git a/pom.xml b/pom.xml index ae5897b6f3..70248b9993 100644 --- a/pom.xml +++ b/pom.xml @@ -466,6 +466,7 @@ spring-5-reactive-client spring-5-mvc spring-5-security + spring-5-security-oauth spring-5-reactive-oauth spring-activiti spring-akka @@ -808,6 +809,7 @@ spring-5-reactive-client spring-5-reactive-security spring-5-security + spring-5-security-oauth spring-activiti spring-akka spring-all @@ -1155,6 +1157,7 @@ spring-5-reactive-client spring-5-mvc spring-5-security + spring-5-security-oauth spring-activiti spring-akka spring-amqp @@ -1460,6 +1463,7 @@ spring-5-reactive-client spring-5-mvc spring-5-security + spring-5-security-oauth spring-activiti spring-akka spring-amqp diff --git a/spring-5-security-oauth/README.md b/spring-5-security-oauth/README.md new file mode 100644 index 0000000000..81d95c07d7 --- /dev/null +++ b/spring-5-security-oauth/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Spring Security 5 -OAuth2 Login](http://www.baeldung.com/spring-security-5-oauth2-login) \ No newline at end of file diff --git a/spring-5-security-oauth/pom.xml b/spring-5-security-oauth/pom.xml new file mode 100644 index 0000000000..33a0677724 --- /dev/null +++ b/spring-5-security-oauth/pom.xml @@ -0,0 +1,72 @@ + + 4.0.0 + com.baeldung + spring-5-security-oauth + 0.0.1-SNAPSHOT + jar + spring-5-security-oauth + spring 5 security oauth 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-springsecurity4 + + + + + 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.0.1.RELEASE + + + diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2/LoginController.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/LoginController.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2/LoginController.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2/LoginController.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2/MvcConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/MvcConfig.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2/MvcConfig.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2/MvcConfig.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2/SecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2/SecurityConfig.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SpringOAuthApplication.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java similarity index 100% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java rename to spring-5-security-oauth/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java diff --git a/spring-5-security/src/main/resources/application-oauth2-extractors-baeldung.properties b/spring-5-security-oauth/src/main/resources/application-oauth2-extractors-baeldung.properties similarity index 100% rename from spring-5-security/src/main/resources/application-oauth2-extractors-baeldung.properties rename to spring-5-security-oauth/src/main/resources/application-oauth2-extractors-baeldung.properties diff --git a/spring-5-security/src/main/resources/application-oauth2-extractors-github.properties b/spring-5-security-oauth/src/main/resources/application-oauth2-extractors-github.properties similarity index 100% rename from spring-5-security/src/main/resources/application-oauth2-extractors-github.properties rename to spring-5-security-oauth/src/main/resources/application-oauth2-extractors-github.properties diff --git a/spring-5-security/src/main/resources/application-oauth2.properties b/spring-5-security-oauth/src/main/resources/application-oauth2.properties similarity index 100% rename from spring-5-security/src/main/resources/application-oauth2.properties rename to spring-5-security-oauth/src/main/resources/application-oauth2.properties diff --git a/spring-5-security-oauth/src/main/resources/application.properties b/spring-5-security-oauth/src/main/resources/application.properties new file mode 100644 index 0000000000..5912b0f755 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/application.properties @@ -0,0 +1,5 @@ +server.port=8081 + +logging.level.root=INFO + +logging.level.com.baeldung.dsl.ClientErrorLoggingFilter=DEBUG \ No newline at end of file diff --git a/spring-5-security-oauth/src/main/resources/logback.xml b/spring-5-security-oauth/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-5-security-oauth/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 diff --git a/spring-5-security-oauth/src/main/resources/static/css/main.css b/spring-5-security-oauth/src/main/resources/static/css/main.css new file mode 100644 index 0000000000..febc353af7 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/static/css/main.css @@ -0,0 +1,8 @@ +p.error { + font-weight: bold; + color: red; +} + +div.logout { + margin-right: 2em;; +} diff --git a/spring-5-security-oauth/src/main/resources/templates/index.html b/spring-5-security-oauth/src/main/resources/templates/index.html new file mode 100644 index 0000000000..4216d74037 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/templates/index.html @@ -0,0 +1,11 @@ + + + + Home + + + + Home + Welcome! + + \ No newline at end of file diff --git a/spring-5-security/src/main/resources/templates/loginFailure.html b/spring-5-security-oauth/src/main/resources/templates/loginFailure.html similarity index 100% rename from spring-5-security/src/main/resources/templates/loginFailure.html rename to spring-5-security-oauth/src/main/resources/templates/loginFailure.html diff --git a/spring-5-security/src/main/resources/templates/loginSuccess.html b/spring-5-security-oauth/src/main/resources/templates/loginSuccess.html similarity index 100% rename from spring-5-security/src/main/resources/templates/loginSuccess.html rename to spring-5-security-oauth/src/main/resources/templates/loginSuccess.html diff --git a/spring-5-security/src/main/resources/templates/oauth2_extractors.html b/spring-5-security-oauth/src/main/resources/templates/oauth2_extractors.html similarity index 100% rename from spring-5-security/src/main/resources/templates/oauth2_extractors.html rename to spring-5-security-oauth/src/main/resources/templates/oauth2_extractors.html diff --git a/spring-5-security/src/main/resources/templates/oauth_login.html b/spring-5-security-oauth/src/main/resources/templates/oauth_login.html similarity index 100% rename from spring-5-security/src/main/resources/templates/oauth_login.html rename to spring-5-security-oauth/src/main/resources/templates/oauth_login.html diff --git a/spring-5-security/src/main/resources/templates/securedPage.html b/spring-5-security-oauth/src/main/resources/templates/securedPage.html similarity index 100% rename from spring-5-security/src/main/resources/templates/securedPage.html rename to spring-5-security-oauth/src/main/resources/templates/securedPage.html diff --git a/spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java b/spring-5-security-oauth/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java similarity index 100% rename from spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java rename to spring-5-security-oauth/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java diff --git a/spring-5-security/README.md b/spring-5-security/README.md index 55fa7ab042..6e094e928f 100644 --- a/spring-5-security/README.md +++ b/spring-5-security/README.md @@ -1,6 +1,5 @@ ## Relevant articles: -- [Spring Security 5 -OAuth2 Login](http://www.baeldung.com/spring-security-5-oauth2-login) - [Extra Login Fields with Spring Security](http://www.baeldung.com/spring-security-extra-login-fields) - [A Custom Spring SecurityConfigurer](http://www.baeldung.com/spring-security-custom-configurer) - [New Password Storage In Spring Security 5](http://www.baeldung.com/spring-security-5-password-storage) diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index f5fb359896..763e505e51 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -33,22 +33,6 @@ org.thymeleaf.extras thymeleaf-extras-springsecurity4 - - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - 2.0.1.RELEASE - - - org.springframework.security - spring-security-oauth2-client - - - org.springframework.security - spring-security-oauth2-jose - - org.springframework spring-test