From bb9c229b527a6cfaf6c3e564866c964c8f5d4fcf Mon Sep 17 00:00:00 2001 From: VarivodaK Date: Thu, 2 Sep 2021 18:24:57 +0300 Subject: [PATCH 1/6] Migration to Java 11 and running locally on Win10; Fixing jjwt exception in Zuul app --- PhotoAppAPIConfigServer/dockerfile | 2 +- PhotoAppAPIConfigServer/pom.xml | 4 ++-- PhotoAppApiAccountManagement/pom.xml | 6 +++--- .../src/main/resources/application.properties | 4 ++-- PhotoAppApiAlbums/dockerfile | 2 +- PhotoAppApiAlbums/pom.xml | 4 ++-- PhotoAppApiUsers/dockerfile | 2 +- PhotoAppApiUsers/pom.xml | 6 +++--- .../photoapp/api/users/security/WebSecurity.java | 9 +++++---- .../src/main/resources/application.properties | 14 ++++++++------ PhotoAppApiZuulAPIGateway/dockerfile | 2 +- PhotoAppApiZuulAPIGateway/pom.xml | 11 ++++++++--- .../src/main/resources/application.properties | 2 +- PhotoAppDiscoveryService/dockerfile | 2 +- PhotoAppDiscoveryService/pom.xml | 6 +++--- .../src/main/resources/application.properties | 6 +++++- 16 files changed, 47 insertions(+), 35 deletions(-) diff --git a/PhotoAppAPIConfigServer/dockerfile b/PhotoAppAPIConfigServer/dockerfile index 6e8f070..e8f5128 100644 --- a/PhotoAppAPIConfigServer/dockerfile +++ b/PhotoAppAPIConfigServer/dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jdk-alpine +FROM openjdk:11 VOLUME /tmp COPY apiEncryptionKey.jks apiEncryptionKey.jks COPY UnlimitedJCEPolicyJDK8/* /usr/lib/jvm/java-1.8-openjdk/jre/lib/security/ diff --git a/PhotoAppAPIConfigServer/pom.xml b/PhotoAppAPIConfigServer/pom.xml index e0c7bc8..368460d 100644 --- a/PhotoAppAPIConfigServer/pom.xml +++ b/PhotoAppAPIConfigServer/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.3.RELEASE + 2.3.12.RELEASE com.appsdeveloperblog.photoapp.api @@ -16,7 +16,7 @@ Config Server - 1.8 + 11 Greenwich.SR1 diff --git a/PhotoAppApiAccountManagement/pom.xml b/PhotoAppApiAccountManagement/pom.xml index 79331ed..512262e 100644 --- a/PhotoAppApiAccountManagement/pom.xml +++ b/PhotoAppApiAccountManagement/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.3.RELEASE + 2.3.12.RELEASE com.appsdeveloperblog.photoapp.api.account @@ -16,8 +16,8 @@ Account Management microservice - 1.8 - Greenwich.RELEASE + 11 + Hoxton.SR12 diff --git a/PhotoAppApiAccountManagement/src/main/resources/application.properties b/PhotoAppApiAccountManagement/src/main/resources/application.properties index 86465c6..1c1865d 100644 --- a/PhotoAppApiAccountManagement/src/main/resources/application.properties +++ b/PhotoAppApiAccountManagement/src/main/resources/application.properties @@ -1,7 +1,7 @@ server.port=0 spring.application.name=account-ws -eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka -spring.devtools.restart.enabled = true +eureka.client.serviceUrl.defaultZone=http://test:test@localhost:8010/eureka +spring.devtools.restart.enabled=true spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 diff --git a/PhotoAppApiAlbums/dockerfile b/PhotoAppApiAlbums/dockerfile index e6cb83f..b31bb50 100644 --- a/PhotoAppApiAlbums/dockerfile +++ b/PhotoAppApiAlbums/dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jdk-alpine +FROM openjdk:11 VOLUME /tmp COPY target/PhotoAppApiAlbums-0.0.1-SNAPSHOT.jar PhotoAppApiAlbums.jar ENTRYPOINT ["java","-jar","PhotoAppApiAlbums.jar"] \ No newline at end of file diff --git a/PhotoAppApiAlbums/pom.xml b/PhotoAppApiAlbums/pom.xml index 910cdf9..e235fe9 100644 --- a/PhotoAppApiAlbums/pom.xml +++ b/PhotoAppApiAlbums/pom.xml @@ -15,8 +15,8 @@ Demo project for Spring Boot - 1.8 - Greenwich.RELEASE + 11 + Hoxton.SR12 diff --git a/PhotoAppApiUsers/dockerfile b/PhotoAppApiUsers/dockerfile index 681057d..ab219ea 100644 --- a/PhotoAppApiUsers/dockerfile +++ b/PhotoAppApiUsers/dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jdk-alpine +FROM openjdk:11 VOLUME /tmp COPY target/PhotoAppApiUsers-0.0.1-SNAPSHOT.jar users-microservice.jar ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/users-microservice.jar"] \ No newline at end of file diff --git a/PhotoAppApiUsers/pom.xml b/PhotoAppApiUsers/pom.xml index 614c729..156feab 100644 --- a/PhotoAppApiUsers/pom.xml +++ b/PhotoAppApiUsers/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.4.RELEASE + 2.3.12.RELEASE com.appsdeveloperblog.photoapp.api.users @@ -16,8 +16,8 @@ Users microservice - 1.8 - Greenwich.RELEASE + 11 + Hoxton.SR12 diff --git a/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/security/WebSecurity.java b/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/security/WebSecurity.java index 27982a3..e0d78ea 100644 --- a/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/security/WebSecurity.java +++ b/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/security/WebSecurity.java @@ -15,7 +15,7 @@ @Configuration @EnableWebSecurity public class WebSecurity extends WebSecurityConfigurerAdapter { - + private Environment environment; private UsersService usersService; private BCryptPasswordEncoder bCryptPasswordEncoder; @@ -31,20 +31,21 @@ public WebSecurity(Environment environment, UsersService usersService, BCryptPas @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); + //if you want to permit to all for testing: + //http.authorizeRequests().antMatchers("/users/**").permitAll() http.authorizeRequests().antMatchers("/**").hasIpAddress(environment.getProperty("gateway.ip")) .and() .addFilter(getAuthenticationFilter()); http.headers().frameOptions().disable(); } - + private AuthenticationFilter getAuthenticationFilter() throws Exception { AuthenticationFilter authenticationFilter = new AuthenticationFilter(usersService, environment, authenticationManager()); - //authenticationFilter.setAuthenticationManager(authenticationManager()); authenticationFilter.setFilterProcessesUrl(environment.getProperty("login.url.path")); return authenticationFilter; } - + @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(usersService).passwordEncoder(bCryptPasswordEncoder); diff --git a/PhotoAppApiUsers/src/main/resources/application.properties b/PhotoAppApiUsers/src/main/resources/application.properties index 05ccc2b..d0fd5d8 100644 --- a/PhotoAppApiUsers/src/main/resources/application.properties +++ b/PhotoAppApiUsers/src/main/resources/application.properties @@ -1,9 +1,11 @@ server.port=${PORT:0} spring.application.name=users-ws -eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka -spring.devtools.restart.enabled = true +eureka.client.serviceUrl.defaultZone=http://test:test@localhost:8010/eureka +spring.devtools.restart.enabled=true eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}} +# From boot 2.3.0 onwards if url is not mentioned it will auto generate database name. Let's specify explicitly instead: +spring.datasource.url=jdbc:h2:mem:testdb spring.h2.console.enabled=true spring.h2.console.settings.web-allow-others=true @@ -12,10 +14,10 @@ spring.h2.console.settings.web-allow-others=true #spring.datasource.password=sergey spring.jpa.hibernate.ddl-auto=update -gateway.ip = 192.168.1.131 -token.expiration_time = 864000000 -token.secret = hfgry463hf746hf573ydh475fhy5739 -login.url.path = /users/login +gateway.ip=192.168.0.105 +token.expiration_time=864000000 +token.secret=hfgry463hf746hf573ydh475fhy5739 +login.url.path=/users/login spring.rabbitmq.host=localhost diff --git a/PhotoAppApiZuulAPIGateway/dockerfile b/PhotoAppApiZuulAPIGateway/dockerfile index 1b39a5b..3a4f570 100644 --- a/PhotoAppApiZuulAPIGateway/dockerfile +++ b/PhotoAppApiZuulAPIGateway/dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8-jdk-alpine +FROM openjdk:11 VOLUME /tmp COPY target/PhotoAppApiZuulAPIGateway-0.0.1-SNAPSHOT.jar ZuulApiGateway.jar ENTRYPOINT ["java","-jar","ZuulApiGateway.jar"] \ No newline at end of file diff --git a/PhotoAppApiZuulAPIGateway/pom.xml b/PhotoAppApiZuulAPIGateway/pom.xml index b1fa7b4..b4240c9 100644 --- a/PhotoAppApiZuulAPIGateway/pom.xml +++ b/PhotoAppApiZuulAPIGateway/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.3.RELEASE + 2.3.12.RELEASE com.appsdeveloperblog.photoapp.api.gateway @@ -16,8 +16,8 @@ Zuul API Gateway microservice - 1.8 - Greenwich.RELEASE + 11 + Hoxton.SR12 @@ -45,6 +45,11 @@ jjwt 0.9.1 + + javax.xml.bind + jaxb-api + 2.3.0 + org.springframework.boot diff --git a/PhotoAppApiZuulAPIGateway/src/main/resources/application.properties b/PhotoAppApiZuulAPIGateway/src/main/resources/application.properties index adce8fa..829cca8 100644 --- a/PhotoAppApiZuulAPIGateway/src/main/resources/application.properties +++ b/PhotoAppApiZuulAPIGateway/src/main/resources/application.properties @@ -1,6 +1,6 @@ spring.application.name=zuul server.port=8011 -eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka +eureka.client.serviceUrl.defaultZone=http://test:test@localhost:8010/eureka api.h2console.url.path = /users-ws/h2-console/** api.registration.url.path = /users-ws/users diff --git a/PhotoAppDiscoveryService/dockerfile b/PhotoAppDiscoveryService/dockerfile index e99b324..b57bc24 100644 --- a/PhotoAppDiscoveryService/dockerfile +++ b/PhotoAppDiscoveryService/dockerfile @@ -1,3 +1,3 @@ -FROM openjdk:8-jdk-alpine +FROM openjdk:11 COPY target/PhotoAppDiscoveryService-0.0.1-SNAPSHOT.jar DiscoveryService.jar ENTRYPOINT ["java","-jar","DiscoveryService.jar"] \ No newline at end of file diff --git a/PhotoAppDiscoveryService/pom.xml b/PhotoAppDiscoveryService/pom.xml index 967eafc..5ac0681 100644 --- a/PhotoAppDiscoveryService/pom.xml +++ b/PhotoAppDiscoveryService/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.3.RELEASE + 2.3.12.RELEASE @@ -17,8 +17,8 @@ Photo App Eureka Discovery Server - 1.8 - Greenwich.RELEASE + 11 + Hoxton.SR12 diff --git a/PhotoAppDiscoveryService/src/main/resources/application.properties b/PhotoAppDiscoveryService/src/main/resources/application.properties index a7732c8..2c1bcf7 100644 --- a/PhotoAppDiscoveryService/src/main/resources/application.properties +++ b/PhotoAppDiscoveryService/src/main/resources/application.properties @@ -2,4 +2,8 @@ server.port=8010 spring.application.name=discoveryservice eureka.client.registerWithEureka=false eureka.client.fetchRegistry=false -eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka \ No newline at end of file +eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka + +#Let's enable logs for debugging purposes. Note, package-specific log level can be enabled or log level for all: +logging.level.org.springframework.security=INFO +logging.level.root=DEBUG \ No newline at end of file From 6c97faaeb4358e91371f1fd1fca63a06cde19c3c Mon Sep 17 00:00:00 2001 From: VarivodaK Date: Mon, 6 Sep 2021 18:30:40 +0300 Subject: [PATCH 2/6] Spring Cloud Config Server fetching from private Github repository --- PhotoAppAPIConfigServer/pom.xml | 5 +-- .../PhotoAppApiConfigServerApplication.java | 6 +-- .../src/main/resources/application.properties | 38 ++++++++++++++----- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/PhotoAppAPIConfigServer/pom.xml b/PhotoAppAPIConfigServer/pom.xml index 368460d..e33f882 100644 --- a/PhotoAppAPIConfigServer/pom.xml +++ b/PhotoAppAPIConfigServer/pom.xml @@ -17,7 +17,7 @@ 11 - Greenwich.SR1 + Hoxton.SR8 @@ -31,8 +31,7 @@ spring-boot-starter-test test - - + org.springframework.cloud spring-cloud-starter-bus-amqp diff --git a/PhotoAppAPIConfigServer/src/main/java/com/appsdeveloperblog/photoapp/api/PhotoAppApiConfigServerApplication.java b/PhotoAppAPIConfigServer/src/main/java/com/appsdeveloperblog/photoapp/api/PhotoAppApiConfigServerApplication.java index af60c13..a5d2d0a 100644 --- a/PhotoAppAPIConfigServer/src/main/java/com/appsdeveloperblog/photoapp/api/PhotoAppApiConfigServerApplication.java +++ b/PhotoAppAPIConfigServer/src/main/java/com/appsdeveloperblog/photoapp/api/PhotoAppApiConfigServerApplication.java @@ -8,8 +8,8 @@ @EnableConfigServer public class PhotoAppApiConfigServerApplication { - public static void main(String[] args) { - SpringApplication.run(PhotoAppApiConfigServerApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(PhotoAppApiConfigServerApplication.class, args); + } } diff --git a/PhotoAppAPIConfigServer/src/main/resources/application.properties b/PhotoAppAPIConfigServer/src/main/resources/application.properties index 892f1c7..9950acd 100644 --- a/PhotoAppAPIConfigServer/src/main/resources/application.properties +++ b/PhotoAppAPIConfigServer/src/main/resources/application.properties @@ -1,19 +1,37 @@ spring.application.name=PhotoAppAPIConfigServer server.port=8012 -spring.profiles.active=native +spring.profiles.active=git -spring.cloud.config.server.native.searchLocations=file://${user.home}/Desktop/dev/config-server-nfs +#spring.cloud.config.server.native.searchLocations=file://${user.home}/Desktop/dev/config-server-nfs -spring.cloud.config.server.git.uri=https://github.com/simplyi/PhotoAppConfiguration -spring.cloud.config.server.git.username=simplyi -spring.cloud.config.server.git.password= +spring.cloud.config.server.git.uri=git@github.com:zkvarz/PhotoAppConfiguration.git spring.cloud.config.server.git.clone-on-start=true spring.cloud.config.server.git.force-pull=true -spring.cloud.config.server.git.searchPaths=usersws,zuul +spring.cloud.config.server.git.default-label=main +#spring.cloud.config.server.git.searchPaths=usersws,zuul +spring.cloud.config.server.git.ignore-local-ssh-settings=true + +#Make sure to generate RSA keys in PEM format! Here is the command I used: ssh-keygen -m PEM -t rsa -b 4096 +spring.cloud.config.server.git.private-key=\ +-----BEGIN RSA PRIVATE KEY-----\n\ +YOURKEY3\n\ +YOURKEY3\n\ +-----END RSA PRIVATE KEY----- + +#Public cloud config example. Useful for testing: +#spring.cloud.config.server.git.uri=https://github.com/spring-cloud-samples/config-repo +#Location where properties will be stored: +#spring.cloud.config.server.git.basedir=target/config +#spring.cloud.config.server.git.default-label=main +#spring.cloud.config.server.git.clone-on-start=true +#spring.cloud.config.server.git.force-pull=true management.endpoints.web.exposure.include=bus-refresh -spring.rabbitmq.host=localhost -spring.rabbitmq.port=5672 -spring.rabbitmq.username=guest -spring.rabbitmq.password=guest +#spring.rabbitmq.host=localhost +#spring.rabbitmq.port=5672 +#spring.rabbitmq.username=guest +#spring.rabbitmq.password=guest + +logging.level.root=INFO +logging.level.org.springframework.cloud=TRACE \ No newline at end of file From b79782d5455f1f3a62273830d11f1fb8a6283a20 Mon Sep 17 00:00:00 2001 From: VarivodaK Date: Thu, 9 Sep 2021 14:27:30 +0300 Subject: [PATCH 3/6] Add docker-compose.yml, add README file with instructions, remove UnlimitedJCEPolicyJDK8 in favor of JDK11, --- .../UnlimitedJCEPolicyJDK8/README.txt | 196 ------------------ .../US_export_policy.jar | Bin 3023 -> 0 bytes .../UnlimitedJCEPolicyJDK8/local_policy.jar | Bin 3035 -> 0 bytes PhotoAppAPIConfigServer/apiEncryptionKey.jks | Bin 2667 -> 2643 bytes PhotoAppAPIConfigServer/dockerfile | 3 +- .../src/main/resources/application.properties | 11 +- .../src/main/resources/bootstrap.properties | 9 +- PhotoAppApiAlbums/pom.xml | 4 +- PhotoAppApiUsers/pom.xml | 9 +- .../users/ui/controllers/UsersController.java | 84 ++++---- PhotoAppApiZuulAPIGateway/pom.xml | 2 +- .../src/main/resources/application.properties | 2 +- README.md | 49 +++++ docker-compose.yml | 75 +++++++ 14 files changed, 184 insertions(+), 260 deletions(-) delete mode 100644 PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/README.txt delete mode 100644 PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/US_export_policy.jar delete mode 100644 PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/local_policy.jar create mode 100644 README.md create mode 100644 docker-compose.yml diff --git a/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/README.txt b/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/README.txt deleted file mode 100644 index c0d9942..0000000 --- a/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/README.txt +++ /dev/null @@ -1,196 +0,0 @@ - - Unlimited Strength Java(TM) Cryptography Extension Policy Files - for the Java(TM) Platform, Standard Edition Runtime Environment 8 - - README - ----------------------------------------------------------------------- -CONTENTS ----------------------------------------------------------------------- - - o Introduction - o License and Terms - o Understanding The Export/Import Issues - o Where To Find Documentation - o Installation - o Questions, Support, Reporting Bugs - - ----------------------------------------------------------------------- -Introduction ----------------------------------------------------------------------- - -Thank you for downloading the Unlimited Strength Java(TM) Cryptography -Extension (JCE) Policy Files for the Java(TM) Platform, Standard -Edition (Java SE) Runtime Environment 8. - -Due to import control restrictions of some countries, the version of -the JCE policy files that are bundled in the Java Runtime Environment, -or JRE(TM), 8 environment allow "strong" but limited cryptography to be -used. This download bundle (the one including this README file) -provides "unlimited strength" policy files which contain no -restrictions on cryptographic strengths. - -Please note that this download file does NOT contain any encryption -functionality as all such functionality is contained within Oracle's -JRE 8. This bundles assumes that the JRE 8 has already been installed. - - ----------------------------------------------------------------------- -License and Terms ----------------------------------------------------------------------- - -This download bundle is part of the Java SE Platform products and is -governed by same License and Terms notices. These notices can be found -on the Java SE download site: - - http://www.oracle.com/technetwork/java/javase/documentation/index.html - - ----------------------------------------------------------------------- -Understanding The Export/Import Issues ----------------------------------------------------------------------- - -JCE for Java SE 8 has been through the U.S. export review process. The -JCE framework, along with the various JCE providers that come standard -with it (SunJCE, SunEC, SunPKCS11, SunMSCAPI, etc), is exportable. - -The JCE architecture allows flexible cryptographic strength to be -configured via jurisdiction policy files. Due to the import -restrictions of some countries, the jurisdiction policy files -distributed with the Java SE 8 software have built-in restrictions on -available cryptographic strength. The jurisdiction policy files in this -download bundle (the bundle including this README file) contain no -restrictions on cryptographic strengths. This is appropriate for most -countries. Framework vendors can create download bundles that include -jurisdiction policy files that specify cryptographic restrictions -appropriate for countries whose governments mandate restrictions. Users -in those countries can download an appropriate bundle, and the JCE -framework will enforce the specified restrictions. - -You are advised to consult your export/import control counsel or -attorney to determine the exact requirements. - - ----------------------------------------------------------------------- -Where To Find Documentation ----------------------------------------------------------------------- - -The following documents may be of interest to you: - - o The Java(TM) Cryptography Architecture (JCA) Reference Guide at: - - http://docs.oracle.com/javase/8/docs/technotes/guides/security - - o The Java SE Security web site has more information about JCE, - plus additional information about the Java SE Security Model. - Please see: - - http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136007.html - - ----------------------------------------------------------------------- -Installation ----------------------------------------------------------------------- - -Notes: - - o Unix (Solaris/Linux/Mac OS X) and Windows use different pathname - separators, so please use the appropriate one ("\", "/") for your - environment. - - o (below) refers to the directory where the JRE was - installed. It is determined based on whether you are running JCE - on a JRE or a JRE contained within the Java Development Kit, or - JDK(TM). The JDK contains the JRE, but at a different level in the - file hierarchy. For example, if the JDK is installed in - /home/user1/jdk1.8.0 on Unix or in C:\jdk1.8.0 on Windows, then - is: - - /home/user1/jdk1.8.0/jre [Unix] - C:\jdk1.8.0\jre [Windows] - - If on the other hand the JRE is installed in /home/user1/jre1.8.0 - on Unix or in C:\jre1.8.0 on Windows, and the JDK is not - installed, then is: - - /home/user1/jre1.8.0 [Unix] - C:\jre1.8.0 [Windows] - - o On Windows, for each JDK installation, there may be additional - JREs installed under the "Program Files" directory. Please make - sure that you install the unlimited strength policy JAR files - for all JREs that you plan to use. - - -Here are the installation instructions: - -1) Download the unlimited strength JCE policy files. - -2) Uncompress and extract the downloaded file. - - This will create a subdirectory called jce. - This directory contains the following files: - - README.txt This file - local_policy.jar Unlimited strength local policy file - US_export_policy.jar Unlimited strength US export policy file - -3) Install the unlimited strength policy JAR files. - - In case you later decide to revert to the original "strong" but - limited policy versions, first make a copy of the original JCE - policy files (US_export_policy.jar and local_policy.jar). Then - replace the strong policy files with the unlimited strength - versions extracted in the previous step. - - The standard place for JCE jurisdiction policy JAR files is: - - /lib/security [Unix] - \lib\security [Windows] - - ------------------------------------------------------------------------ -Questions, Support, Reporting Bugs ------------------------------------------------------------------------ - -Questions ---------- - -For miscellaneous questions about JCE usage and deployment, we -encourage you to read: - - o Information on the Java SE Security web site - - http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136007.html - - o The Oracle Online Community Forums, specifically the Java - Cryptography forum. The forums allow you to tap into the - experience of other users, ask questions, or offer tips to others - on a variety of Java-related topics, including JCE. There is no - fee to participate. - - http://forums.oracle.com/ - http://forums.oracle.com/forums/forum.jspa?forumID=964 (JCE - forum) - - -Support -------- - -For more extensive JCE questions or deployment issues, please contact -our Technical Support staff at: - - http://support.oracle.com - - -Reporting Bugs --------------- - -To report bugs (with sample code) or request a feature, please see: - - http://bugs.sun.com/ - http://bugreport.sun.com/bugreport/ - -Bug reports with specific, reproducible test cases are greatly -appreciated! diff --git a/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/US_export_policy.jar b/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/US_export_policy.jar deleted file mode 100644 index 251b102c57c076504ba818330e4fceb4509753d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3023 zcma)82Q-^|AC9d?+fPt?)UHutUz8wm36X=Jzvp*;&-**idH&~l;4nIRP5?7AGoaZf)c|m! zIH_kdh!t4g_%igO8Thg>6k=(mU63ZbT|Xr|6!~>UD!I2VF6jX z$GM}7FXJ9BPm2h}ojWt>yzYF*AENmL?3EQ|Wx57%(kk_(%)j)Cic4=M)t!R(J5+n{ z6$dc|v+dl`NQ~&BI0-uuCFC9Sltr~f2|@(eczH?8s;HjHm+~0Lipyi%ar)Y|xLM8d zgf5x~dtR1v-C-vN!j_A zBA~o%?BN|j-OQ?+M_GtCHZ)<>9(L9HX^LET3f(5v1J|pC_m~=Ion4DznxFKYNIyXtR_FP>=OeFUeypaYVAgaACTrFc1u(snGASKw~TE*&3zwyjZ;=B%rw!d*yxp^U4g=c3R-(0 zzeAyJuJ94(vP#z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U(r<^=pz!|htL65TmL$IRm=E2wu*1y-hioed(m)%XFW7#jbi;S6C%=g z{BVe$?V@x@^5(07HhEo~tAcl^S(N1YiT9_&ADHL%Ik8mpzM@d2-)ysDyf+D3cjq7N zM?8$Swz@rd52}`zTjRY^P-#?yAI`m-vlhLYRxm9SLmrTu+wu>fnlarM^2D1<>?XK4 zw=MkWs}&7C0AQYfr@bAL+MNId0KD4?V5`)SNBV$B-yc-Zl*sKoXb{R zhA!#p?{}xKd6ef={5G8kIo*?Oh{_hQ7r({hZg*rBq2lLR`b~aZR-@=5nvS#_Jbb%lFUL*rb-ui4>;M>9vrmFITi#^Bc?6A-!2h;y6NfxOkp4Q1)c{rgG{9cpY@&VC=(Y`KO8w41`%ZPf_dDS3_sz zw&J-TRDlFr&&S%PB_54zW084QD%|bQBT971w}~MW*9kd7 zZ=P`p-C!nJrI^#KKiP;gmN)g*4TBS#LxPVV>FieE2!YTd_LPh5*M)z3HW#-TU^_|f z3{V^??5=;ym1yKP0w-wgOa!|T4zlO%pWlqV^xs-zCjv)*JNf14Z@cyg>{25d$p_?20@+U# Lo19~UoUi`@yDZ_Z diff --git a/PhotoAppAPIConfigServer/apiEncryptionKey.jks b/PhotoAppAPIConfigServer/apiEncryptionKey.jks index dca3810c6748676a2b01ec2921b3e0cfc41f52ca..925478f2cf1a948098a2e2d21b1cb32b0d3063f6 100644 GIT binary patch delta 2523 zcmV<12_*LG6w?$UFoFtC0s#Xsf(i%*2`Yw2hW8Bt2LYgh3Hbzq3H3073GtC4Mt>;~ zv_5AB5dih8*9o}Al_e#rjr{@x0K-rOf&|ETzfucRDQ0OhaU1DZeCQwPNxdM-!?U<$zOjhs;yao8;GJBPn zGLU4pDq)^f{z)i=>-*NrhLC3B1$suI5`_wocF$}mKFJKMy@mn!CM~`HQ3uOP9t$(ZWTHZ`v zv=3iG^~HCJoH>}PR(B}4Q%?Xd17og`U=Hk7B4fm?zk#(@-exfRO~A<$INVSch;O}^ zBjyW@nw!L?LpV+-(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b)>u14)tRKEU?k+N4u@pw*?J@aEE zJcAEJ9~iI_eCLDtJ`5g57IRLBp$LRuai8ic4^JXt;Qt%Ts>OTc(#Uq>e|n~WXS-k= z9yzQ#Q0p~Rh~OT7CPGTPzjsisGAyaxhxy+puSI8=rd(!F1i~ge{uy%)7FiT-g&{^M_D((`M ztIFZ_P7Ib^k=h{TSqqc8e@q-t)wWY_lxtk+HvKc2<@tsW33iMO^G-scAPN?;Mo~~K zkDXzp7V_y1%l+#2ee8u6qAJf8c{Tgh@tHCefHa ziDmJK=y09N?(`{FW5rX%jPqPS+$E#5xB8#QgFg$bM3hz0F8)K=uqTxN^EA0k;o_T? zmAh2Z90TZ@3?SEP1zJb;C+Iv$9|?R~aeMHKcMVhL)Skp={nP$9^X=yyn%zYYSYl&? zmH|Z1h|~vU5fJGWe~Ev;01NvvT&`18f11&>E5|fXR2PkuDBjjK51%j|q&77JyV#J` z^PkEC2%OMinPqQ87vj org.springframework.boot spring-boot-starter-parent - 2.1.2.RELEASE + 2.3.12.RELEASE com.appsdeveloperblog.photoapp.api.albums @@ -44,7 +44,7 @@ org.modelmapper modelmapper - 2.0.0 + 2.4.4 diff --git a/PhotoAppApiUsers/pom.xml b/PhotoAppApiUsers/pom.xml index 156feab..487c1b3 100644 --- a/PhotoAppApiUsers/pom.xml +++ b/PhotoAppApiUsers/pom.xml @@ -58,7 +58,7 @@ org.modelmapper modelmapper - 2.3.2 + 2.4.4 @@ -67,13 +67,6 @@ spring-boot-starter-security - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.9.8 - - io.jsonwebtoken diff --git a/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/ui/controllers/UsersController.java b/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/ui/controllers/UsersController.java index 358a128..e298474 100644 --- a/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/ui/controllers/UsersController.java +++ b/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/ui/controllers/UsersController.java @@ -1,9 +1,13 @@ package com.appsdeveloperblog.photoapp.api.users.ui.controllers; - import org.modelmapper.ModelMapper; +import com.appsdeveloperblog.photoapp.api.users.service.UsersService; +import com.appsdeveloperblog.photoapp.api.users.shared.UserDto; +import com.appsdeveloperblog.photoapp.api.users.ui.model.CreateUserRequestModel; +import com.appsdeveloperblog.photoapp.api.users.ui.model.CreateUserResponseModel; +import com.appsdeveloperblog.photoapp.api.users.ui.model.UserResponseModel; +import org.modelmapper.ModelMapper; import org.modelmapper.convention.MatchingStrategies; import org.springframework.beans.factory.annotation.Autowired; - import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -15,54 +19,46 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.appsdeveloperblog.photoapp.api.users.ui.model.CreateUserRequestModel; -import com.appsdeveloperblog.photoapp.api.users.ui.model.CreateUserResponseModel; -import com.appsdeveloperblog.photoapp.api.users.ui.model.UserResponseModel; -import com.appsdeveloperblog.photoapp.api.users.service.*; -import com.appsdeveloperblog.photoapp.api.users.shared.*; - @RestController @RequestMapping("/users") public class UsersController { - - @Autowired - private Environment env; - - @Autowired - UsersService usersService; - @GetMapping("/status/check") - public String status() - { - return "Working on port " + env.getProperty("local.server.port") + ", with token = " + env.getProperty("token.secret"); - } - - @PostMapping( - consumes = { MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE }, - produces = { MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE } - ) - public ResponseEntity createUser(@RequestBody CreateUserRequestModel userDetails) - { - ModelMapper modelMapper = new ModelMapper(); - modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); - - UserDto userDto = modelMapper.map(userDetails, UserDto.class); - - UserDto createdUser = usersService.createUser(userDto); - - CreateUserResponseModel returnValue = modelMapper.map(createdUser, CreateUserResponseModel.class); - - return ResponseEntity.status(HttpStatus.CREATED).body(returnValue); - } - - @GetMapping(value="/{userId}", produces = { MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE }) + @Autowired + private Environment env; + + @Autowired + UsersService usersService; + + @GetMapping("/status/check") + public String status() { + return "Working on port " + env.getProperty("local.server.port") + ", with token = " + env.getProperty("token.secret") + + ", token.expiration_time = " + env.getProperty("token.expiration_time"); + } + + @PostMapping( + consumes = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE}, + produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE} + ) + public ResponseEntity createUser(@RequestBody CreateUserRequestModel userDetails) { + ModelMapper modelMapper = new ModelMapper(); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + + UserDto userDto = modelMapper.map(userDetails, UserDto.class); + + UserDto createdUser = usersService.createUser(userDto); + + CreateUserResponseModel returnValue = modelMapper.map(createdUser, CreateUserResponseModel.class); + + return ResponseEntity.status(HttpStatus.CREATED).body(returnValue); + } + + @GetMapping(value = "/{userId}", produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity getUser(@PathVariable("userId") String userId) { - - UserDto userDto = usersService.getUserByUserId(userId); + + UserDto userDto = usersService.getUserByUserId(userId); UserResponseModel returnValue = new ModelMapper().map(userDto, UserResponseModel.class); - + return ResponseEntity.status(HttpStatus.OK).body(returnValue); } - - + } diff --git a/PhotoAppApiZuulAPIGateway/pom.xml b/PhotoAppApiZuulAPIGateway/pom.xml index b4240c9..8123fc7 100644 --- a/PhotoAppApiZuulAPIGateway/pom.xml +++ b/PhotoAppApiZuulAPIGateway/pom.xml @@ -48,7 +48,7 @@ javax.xml.bind jaxb-api - 2.3.0 + 2.3.1 diff --git a/PhotoAppDiscoveryService/src/main/resources/application.properties b/PhotoAppDiscoveryService/src/main/resources/application.properties index 2c1bcf7..c884d3f 100644 --- a/PhotoAppDiscoveryService/src/main/resources/application.properties +++ b/PhotoAppDiscoveryService/src/main/resources/application.properties @@ -6,4 +6,4 @@ eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka #Let's enable logs for debugging purposes. Note, package-specific log level can be enabled or log level for all: logging.level.org.springframework.security=INFO -logging.level.root=DEBUG \ No newline at end of file +#logging.level.root=DEBUG \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..941a394 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +## README + +ANSI terminal coloring wasn't working for in Intellj Idea. To enable it environment variable can be used: +`spring.output.ansi.enabled=always` + +JCE comes bundled with JDK11 so we don't need to install it separately: +`https://www.oracle.com/java/technologies/javase/jdk11-readme.html` + +To run rabbitmq I use docker image instead of installing it manually. Pulling an image: + +`docker pull rabbitmq:management` + +Then running: + +`docker run –d --hostname my-rabbit --name some-rabbit –p 15672:15672 –p 5672:5672 rabbitmq:management` + +**Other useful docker commands.** + +Show all running containers: + +`docker ps` + +And then stop container: + +`docker stop YOUR_CONTAINER_ID` + +Or stop all running containers: + +`docker stop $(docker ps -aq)` + +Before trying running anything in Docker use for each project: + +`mvn clean install` + +Check compose file for syntax-errors: + +`docker-compose config` + +Build our images, create the defined containers, and start in detached mode via one command: +`docker-compose up --build -d` + +To stop the containers, remove them from Docker and remove the connected networks from it: + +`docker-compose down` + + + + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..fdb13ab --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,75 @@ +version: '3' +services: + rabbitmq-container: + image: rabbitmq:3-management + ports: + - 5672:5672 + - 15672:15672 + volumes: + - ./rabbitmq/definitions.json:/etc/rabbitmq/definitions.json:ro + - ./rabbitmq/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro + + photo-app-cloud-config: + container_name: photo-app-cloud-config + build: + context: PhotoAppAPIConfigServer + dockerfile: dockerfile + image: photo-app-cloud-config + ports: + - 8012:8012 + environment: + - ENCRYPT.KEY-STORE.LOCATION=file:///apiEncryptionKey.jks + - SPRING.RABBITMQ.HOST=rabbitmq-container + depends_on: + - rabbitmq-container + + photo-app-cloud-discovery: + container_name: photo-app-cloud-discovery + build: + context: PhotoAppDiscoveryService + dockerfile: dockerfile + image: photo-app-cloud-discovery + ports: + - 8010:8010 + environment: + - SPRING.CLOUD.CONFIG.URI=http://photo-app-cloud-config:8012 + depends_on: + - rabbitmq-container + - photo-app-cloud-config + + photo-app-cloud-zuul: + container_name: photo-app-cloud-zuul + build: + context: PhotoAppApiZuulAPIGateway + dockerfile: dockerfile + image: photo-app-cloud-zuul + ports: + - 8011:8011 + environment: + - SPRING.CLOUD.CONFIG.URI=http://photo-app-cloud-config:8012 + - SPRING.RABBITMQ.HOST=rabbitmq-container + - EUREKA.CLIENT.SERVICEURL.DEFAULTZONE=http://test:test@photo-app-cloud-discovery:8010/eureka + depends_on: + - rabbitmq-container + - photo-app-cloud-config + - photo-app-cloud-discovery + + photo-app-cloud-users: + container_name: photo-app-cloud-users + build: + context: PhotoAppApiUsers + dockerfile: dockerfile + image: photo-app-cloud-users + ports: + - 8000:8000 + environment: + - SPRING.CLOUD.CONFIG.URI=http://photo-app-cloud-config:8012 + - SPRING.RABBITMQ.HOST=rabbitmq-container + - EUREKA.CLIENT.SERVICEURL.DEFAULTZONE=http://test:test@photo-app-cloud-discovery:8010/eureka + - SERVER.PORT=8000 + # You can use container as name instead of ip, docker will automatically determine what the right ip: + - GATEWAY.IP=photo-app-cloud-zuul + depends_on: + - rabbitmq-container + - photo-app-cloud-config + - photo-app-cloud-discovery \ No newline at end of file From 3b16a7924eea8c93e45a2ab3226456f5fffbeeab Mon Sep 17 00:00:00 2001 From: VarivodaK Date: Thu, 9 Sep 2021 15:32:26 +0300 Subject: [PATCH 4/6] Fixing PhotoApp docker-compose start options to retry fetching from cloud server --- docker-compose.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index fdb13ab..677de66 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,6 +69,11 @@ services: - SERVER.PORT=8000 # You can use container as name instead of ip, docker will automatically determine what the right ip: - GATEWAY.IP=photo-app-cloud-zuul + # Make application resilient to config-server failure and able config-client to retry the connection on startup: + - SPRING.CLOUD.CONFIG.FAIL-FAST=true + - SPRING.CLOUD.CONFIG.RETRY.MAX-ATTEMPTS=20 + - SPRING.CLOUD.CONFIG.RETRY.MAX-INTERVAL=2000 + - SPRING.CLOUD.CONFIG.RETRY.INITIAL-INTERVAL=2000 depends_on: - rabbitmq-container - photo-app-cloud-config From d52a4b9a9ba9b4fe317bdd960ca2e0cb15a9c00a Mon Sep 17 00:00:00 2001 From: VarivodaK Date: Thu, 9 Sep 2021 15:57:14 +0300 Subject: [PATCH 5/6] Add albums app to the docker-compose.yml --- .../src/main/resources/application.properties | 2 +- docker-compose.yml | 24 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/PhotoAppApiAlbums/src/main/resources/application.properties b/PhotoAppApiAlbums/src/main/resources/application.properties index 58920d0..cc4758a 100644 --- a/PhotoAppApiAlbums/src/main/resources/application.properties +++ b/PhotoAppApiAlbums/src/main/resources/application.properties @@ -1,7 +1,7 @@ server.port=${PORT:0} spring.application.name=albums-ws -eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka +eureka.client.serviceUrl.defaultZone=http://test:test@localhost:8010/eureka eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}} spring.devtools.restart.enabled = true diff --git a/docker-compose.yml b/docker-compose.yml index 677de66..543b668 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,11 +10,11 @@ services: - ./rabbitmq/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro photo-app-cloud-config: + image: photo-app-cloud/config container_name: photo-app-cloud-config build: context: PhotoAppAPIConfigServer dockerfile: dockerfile - image: photo-app-cloud-config ports: - 8012:8012 environment: @@ -24,11 +24,11 @@ services: - rabbitmq-container photo-app-cloud-discovery: + image: photo-app-cloud/discovery container_name: photo-app-cloud-discovery build: context: PhotoAppDiscoveryService dockerfile: dockerfile - image: photo-app-cloud-discovery ports: - 8010:8010 environment: @@ -38,11 +38,11 @@ services: - photo-app-cloud-config photo-app-cloud-zuul: + image: photo-app-cloud/zuul container_name: photo-app-cloud-zuul build: context: PhotoAppApiZuulAPIGateway dockerfile: dockerfile - image: photo-app-cloud-zuul ports: - 8011:8011 environment: @@ -55,11 +55,11 @@ services: - photo-app-cloud-discovery photo-app-cloud-users: + image: photo-app-cloud/users container_name: photo-app-cloud-users build: context: PhotoAppApiUsers dockerfile: dockerfile - image: photo-app-cloud-users ports: - 8000:8000 environment: @@ -77,4 +77,20 @@ services: depends_on: - rabbitmq-container - photo-app-cloud-config + - photo-app-cloud-discovery + + photo-app-cloud-albums: + image: photo-app-cloud/albums + container_name: photo-app-cloud-albums + build: + context: PhotoAppApiAlbums + dockerfile: dockerfile + ports: + - 8001:8001 + environment: + - SPRING.RABBITMQ.HOST=rabbitmq-container + - EUREKA.CLIENT.SERVICEURL.DEFAULTZONE=http://test:test@photo-app-cloud-discovery:8010/eureka + - SERVER.PORT=8001 + depends_on: + - rabbitmq-container - photo-app-cloud-discovery \ No newline at end of file From c81adb0048b7ac0d821efb9dea39910821b72415 Mon Sep 17 00:00:00 2001 From: VarivodaK Date: Mon, 13 Sep 2021 17:11:37 +0300 Subject: [PATCH 6/6] Add albums microservice url and exception name properties, code cleanup; zipkin server added in docker-compose --- PhotoAppApiUsers/pom.xml | 7 ++++++ .../users/PhotoAppApiUsersApplication.java | 5 ++-- .../api/users/service/UsersServiceImpl.java | 25 ++++++++----------- .../application-production.properties | 4 +++ .../src/main/resources/application.properties | 4 +++ docker-compose.yml | 13 +++++++++- 6 files changed, 39 insertions(+), 19 deletions(-) diff --git a/PhotoAppApiUsers/pom.xml b/PhotoAppApiUsers/pom.xml index 487c1b3..fb8322e 100644 --- a/PhotoAppApiUsers/pom.xml +++ b/PhotoAppApiUsers/pom.xml @@ -67,6 +67,13 @@ spring-boot-starter-security + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + 2.9.8 + + io.jsonwebtoken diff --git a/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/PhotoAppApiUsersApplication.java b/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/PhotoAppApiUsersApplication.java index d8ec5f4..3461123 100644 --- a/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/PhotoAppApiUsersApplication.java +++ b/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/PhotoAppApiUsersApplication.java @@ -13,8 +13,6 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.web.client.RestTemplate; -import com.appsdeveloperblog.photoapp.api.users.shared.FeignErrorDecoder; - import feign.Logger; @SpringBootApplication @@ -77,7 +75,8 @@ public String createDevelopmentBean() { System.out.println("Development bean created. myapplication.environment = " + environment.getProperty("myapplication.environment")); return "Development bean"; } - + + //As FeignErrorDecoder class is annotated with Component this is not needed, left for reference. /* @Bean public FeignErrorDecoder getFeignErrorDecoder() diff --git a/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/service/UsersServiceImpl.java b/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/service/UsersServiceImpl.java index 6e55eb3..129eeb3 100644 --- a/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/service/UsersServiceImpl.java +++ b/PhotoAppApiUsers/src/main/java/com/appsdeveloperblog/photoapp/api/users/service/UsersServiceImpl.java @@ -1,31 +1,25 @@ package com.appsdeveloperblog.photoapp.api.users.service; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - +import com.appsdeveloperblog.photoapp.api.users.data.AlbumsServiceClient; +import com.appsdeveloperblog.photoapp.api.users.data.UserEntity; +import com.appsdeveloperblog.photoapp.api.users.data.UsersRepository; +import com.appsdeveloperblog.photoapp.api.users.shared.UserDto; +import com.appsdeveloperblog.photoapp.api.users.ui.model.AlbumResponseModel; import org.modelmapper.ModelMapper; import org.modelmapper.convention.MatchingStrategies; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.env.Environment; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; -import com.appsdeveloperblog.photoapp.api.users.shared.UserDto; -import com.appsdeveloperblog.photoapp.api.users.ui.model.AlbumResponseModel; - -import feign.FeignException; - -import com.appsdeveloperblog.photoapp.api.users.data.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; @Service public class UsersServiceImpl implements UsersService { @@ -95,7 +89,8 @@ public UserDto getUserByUserId(String userId) { if(userEntity == null) throw new UsernameNotFoundException("User not found"); UserDto userDto = new ModelMapper().map(userEntity, UserDto.class); - + + //Uncomment to use RestTemplate with client side load balancing /* String albumsUrl = String.format(environment.getProperty("albums.url"), userId); diff --git a/PhotoAppApiUsers/src/main/resources/application-production.properties b/PhotoAppApiUsers/src/main/resources/application-production.properties index c18fe27..6193ad2 100644 --- a/PhotoAppApiUsers/src/main/resources/application-production.properties +++ b/PhotoAppApiUsers/src/main/resources/application-production.properties @@ -4,6 +4,10 @@ eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka spring.devtools.restart.enabled = true eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}} +#Used if RestTemplate is used to call albums microservice +albums.url=http://ALBUMS-WS/users/%s/albums +albums.exceptions.albums-not-found=Users albums are not found + spring.h2.console.enabled=true spring.h2.console.settings.web-allow-others=true diff --git a/PhotoAppApiUsers/src/main/resources/application.properties b/PhotoAppApiUsers/src/main/resources/application.properties index d0fd5d8..2df3d7e 100644 --- a/PhotoAppApiUsers/src/main/resources/application.properties +++ b/PhotoAppApiUsers/src/main/resources/application.properties @@ -4,6 +4,10 @@ eureka.client.serviceUrl.defaultZone=http://test:test@localhost:8010/eureka spring.devtools.restart.enabled=true eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}} +#Used if RestTemplate is used to call albums microservice +albums.url=http://ALBUMS-WS/users/%s/albums +albums.exceptions.albums-not-found=Users albums are not found + # From boot 2.3.0 onwards if url is not mentioned it will auto generate database name. Let's specify explicitly instead: spring.datasource.url=jdbc:h2:mem:testdb spring.h2.console.enabled=true diff --git a/docker-compose.yml b/docker-compose.yml index 543b668..047b549 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -74,10 +74,12 @@ services: - SPRING.CLOUD.CONFIG.RETRY.MAX-ATTEMPTS=20 - SPRING.CLOUD.CONFIG.RETRY.MAX-INTERVAL=2000 - SPRING.CLOUD.CONFIG.RETRY.INITIAL-INTERVAL=2000 + - SPRING.ZIPKIN.BASE-URL=http://zipkin:9411 depends_on: - rabbitmq-container - photo-app-cloud-config - photo-app-cloud-discovery + - zipkin photo-app-cloud-albums: image: photo-app-cloud/albums @@ -93,4 +95,13 @@ services: - SERVER.PORT=8001 depends_on: - rabbitmq-container - - photo-app-cloud-discovery \ No newline at end of file + - photo-app-cloud-discovery + + # For reference: https://github.com/openzipkin/zipkin/blob/master/docker/examples/docker-compose-example.yml + zipkin: + image: ghcr.io/openzipkin/zipkin-slim:${TAG:-latest} + container_name: zipkin + ports: + - 9411:9411 + # Uncomment to enable debug logging + # command: --logging.level.zipkin2=DEBUG \ No newline at end of file