From be0e2347e5f408d020f5adc4de2c538905f2e929 Mon Sep 17 00:00:00 2001 From: dizda13 Date: Sat, 1 Apr 2017 14:00:40 +0200 Subject: [PATCH] some service and encryption --- config | 2 +- config_server/build.gradle | 2 ++ .../gradle/wrapper/gradle-wrapper.properties | 3 ++- .../src/main/resources/application.properties | 10 +++++++-- .../src/main/resources/config-server.jks | Bin 0 -> 1327 bytes events/build.gradle | 1 + .../java/ba/steleks/EventsApplication.java | 20 +++++++++++++++++- .../config-client-development.properties | 1 + .../src/main/resources/application.properties | 5 +++++ .../src/main/resources/bootstrap.properties | 5 +++-- teams/build.gradle | 1 + .../src/main/resources/application.properties | 6 +++++- users/build.gradle | 1 + .../src/main/resources/application.properties | 6 +++++- 14 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 config_server/src/main/resources/config-server.jks create mode 100644 events/src/main/java/ba/steleks/repository/config-client-development.properties diff --git a/config b/config index 6a4ab46..cd84d77 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit 6a4ab461b1a268817b4ba0683707e22e5c941ac8 +Subproject commit cd84d77e5aa3d21c7bb360a35d3de960faffc537 diff --git a/config_server/build.gradle b/config_server/build.gradle index 88a9356..82b19ab 100644 --- a/config_server/build.gradle +++ b/config_server/build.gradle @@ -29,6 +29,8 @@ dependencies { compile('org.springframework.boot:spring-boot-starter') testCompile('org.springframework.boot:spring-boot-starter-test') compile('org.springframework.cloud:spring-cloud-config-server') + compile('org.springframework.boot:spring-boot-starter-security') + compile('org.springframework.boot:spring-boot-starter-web') } diff --git a/config_server/gradle/wrapper/gradle-wrapper.properties b/config_server/gradle/wrapper/gradle-wrapper.properties index 293fd09..136d0a4 100644 --- a/config_server/gradle/wrapper/gradle-wrapper.properties +++ b/config_server/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Tue Mar 28 22:05:15 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/config_server/src/main/resources/application.properties b/config_server/src/main/resources/application.properties index 20eca9a..06f6b60 100644 --- a/config_server/src/main/resources/application.properties +++ b/config_server/src/main/resources/application.properties @@ -1,3 +1,9 @@ server.port=8888 - -spring.cloud.config.server.git.uri=${HOME}/NWT/steleks_web_app/config \ No newline at end of file +spring.cloud.config.server.git.uri=https://github.com/esensar/steleks_config +spring.cloud.config.server.git.clone-on-start=true +security.user.name=root +security.user.password=skorpion +encrypt.key-store.location=classpath:config-server.jks +encrypt.key-store.password=my-s70r3-s3cr3t +encrypt.key-store.alias=config-server-key +encrypt.key-store.secret=my-k34-s3cr3t \ No newline at end of file diff --git a/config_server/src/main/resources/config-server.jks b/config_server/src/main/resources/config-server.jks new file mode 100644 index 0000000000000000000000000000000000000000..69856828981622892e9567f8681a29bc3376bde6 GIT binary patch literal 1327 zcmezO_TO6u1_mY|W&~rw*M0jZYx^!}4Igh~QrK(We+2c09nSRS2+5Ouk$xmOUzq)1ll$VK* z`p*@ty^vVQ6Tq759`s<7{d|s7>?c!mBocik{k~35_j2KtxM-QXs-^Y$SFM+J5{{i> zTK=p4|8J48j92*Y^te);@uEbv+S??z0_p2=zsnWpUfkAW@Jj3Wbo1HAMb=cGN>`5m zx`6Y3`>CA<`ZZzqA64s0YM-p!Grf@|?W5A%{jG%ZdEfnk3j_uF=>?3*fwV2pbN!6CaJz8(J z@~1FoH(%-B#d~7?c1^#XKT6N?MsAIjSbo0Z$~jB5uSeOGj!2$#6KdlU{Gng+qiX)U zvjRK*CbC6K3a+?#t5eXU_}=#$+ZKz5F0ozu_{^-^U3O3TK7|M^l{ls>Y~9^-omG54(R8s-6-jraWc8`?4ob_x(|j%-3n(_Idhe@zUivORZjRxj%8s zwUk4`oY$|)C)quI;S_&!lY`>Jn$$yE4T^mBzyGaiTVr|P%7V9BZUi2m&HrM{lKZMU zN`7zBPU@Tz=nabt&o9^>DsHW@BPTmJoY_lq>Io~SH@1JYlO%4xk3D^-@b~$Sl}dY9 zWW#RlZ3eH% z>Sm45Gc~XTreq~xN|rNdVr*Z)%*4pV#KIDBP0xUrjZ>@5qwPB{BO@;>gMpKwpaDM{ zb0`a!Fo#oOYEDXNUb>;EfiOsjTbL)fpeQphUBNjgzcj^A%s>Pr%q-0749-6a!QlL3 zAScdiXl`I^Y-ng=Y;0^A1?HL=Swgu~v7>Q5vde)vlDV;$!Jx5|sj-n^rkwr7%B_Xl z9&cbgt;Ej|xwMmw!Da60d51L5ZcPo6Gtyy{+WD$Y>G=2Zf`%~R^b)_iBR|y7syt_5 z;WSx$*@TbfG;?s9Rhz(Hi^-+Cnzgl0|66$F?XCKVbJEkB&d%_={O{DIpRYL={rF?S z7QOCid!d@A)9kxh7fs7%s4jE4?{S@pnUR5Uv7&*zfh;h5WcgUcSVWfYbQ3x5y<7Tv zJ)7U=DH*HVC$C;qufGXtHT)qPjop6BJu%r~!vm8sO8AWSxX5c-Ivootzvlk@*Rm*Y;ZFzd6rFvV zK262ppR1jk@I6cY_j}(9&bslqY3i8=LiQW1Po|qi#?`SY{*>@kG@E!oyVQEul$#;< Xr{4Wv=_WIKU4%%h$P7arrBX!zQI9H~ literal 0 HcmV?d00001 diff --git a/events/build.gradle b/events/build.gradle index a41d23c..426e80e 100644 --- a/events/build.gradle +++ b/events/build.gradle @@ -31,6 +31,7 @@ dependencies { compile('org.springframework.cloud:spring-cloud-starter-config') compile('org.springframework.boot:spring-boot-starter-actuator') compile('org.springframework.boot:spring-boot-starter-web') + compile('mysql:mysql-connector-java') } dependencyManagement { diff --git a/events/src/main/java/ba/steleks/EventsApplication.java b/events/src/main/java/ba/steleks/EventsApplication.java index e6c1f36..a7a81f6 100644 --- a/events/src/main/java/ba/steleks/EventsApplication.java +++ b/events/src/main/java/ba/steleks/EventsApplication.java @@ -4,7 +4,9 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @@ -22,8 +24,24 @@ class MessageRestController { @Value("${message:Hello default}") private String message; + @Value("${user.password}") + private String password; + @RequestMapping("/message") String getMessage() { return this.message; } -} \ No newline at end of file + + //@RequestMapping(path ="/temp", value = "/{id}", method = RequestMethod.GET) + //String getTemp(@PathVariable("id") Long id){ + // return "temp " + Long.toString(id); + //} + + @RequestMapping(value = "/whoami/{user}", method = RequestMethod.GET) + public String whoami(@PathVariable("username") String username) { + return String.format("Hello! You're %s and you'll become a(n) root, " + + "but only if your password is '%s'!\n", + username, password); + } +} + diff --git a/events/src/main/java/ba/steleks/repository/config-client-development.properties b/events/src/main/java/ba/steleks/repository/config-client-development.properties new file mode 100644 index 0000000..e83e8c0 --- /dev/null +++ b/events/src/main/java/ba/steleks/repository/config-client-development.properties @@ -0,0 +1 @@ +user.password={"description":"No key was installed for encryption service","status":"NO_KEY"} diff --git a/events/src/main/resources/application.properties b/events/src/main/resources/application.properties index eade546..f6be723 100644 --- a/events/src/main/resources/application.properties +++ b/events/src/main/resources/application.properties @@ -1,4 +1,9 @@ server.port = 9020 +spring.datasource.url = jdbc:mysql://localhost:3306/events +spring.datasource.username = root +spring.datasource.password = skorpion +spring.jpa.generate-ddl=true + # #spring.datasource.url = jdbc:mysql://localhost:3306/events #spring.datasource.username = root diff --git a/events/src/main/resources/bootstrap.properties b/events/src/main/resources/bootstrap.properties index 6a10cbe..8a74bcf 100644 --- a/events/src/main/resources/bootstrap.properties +++ b/events/src/main/resources/bootstrap.properties @@ -1,4 +1,5 @@ -spring.application.name=a-bootiful-client +spring.application.name=steleks # N.B. this is the default: spring.cloud.config.uri=http://localhost:8888 -management.security.enabled=false \ No newline at end of file +spring.cloud.config.username=root +spring.cloud.config.password=skorpion \ No newline at end of file diff --git a/teams/build.gradle b/teams/build.gradle index 7581b53..7558c1a 100644 --- a/teams/build.gradle +++ b/teams/build.gradle @@ -27,4 +27,5 @@ dependencies { compile('org.springframework.boot:spring-boot-starter-data-rest') runtime('com.h2database:h2') testCompile('org.springframework.boot:spring-boot-starter-test') + compile('mysql:mysql-connector-java') } diff --git a/teams/src/main/resources/application.properties b/teams/src/main/resources/application.properties index 943d197..2e9716f 100644 --- a/teams/src/main/resources/application.properties +++ b/teams/src/main/resources/application.properties @@ -1 +1,5 @@ -server.port=9010 \ No newline at end of file +server.port=9010 +spring.datasource.url = jdbc:mysql://localhost:3306/teams +spring.datasource.username = root +spring.datasource.password = skorpion +spring.jpa.generate-ddl=true \ No newline at end of file diff --git a/users/build.gradle b/users/build.gradle index 7581b53..7558c1a 100644 --- a/users/build.gradle +++ b/users/build.gradle @@ -27,4 +27,5 @@ dependencies { compile('org.springframework.boot:spring-boot-starter-data-rest') runtime('com.h2database:h2') testCompile('org.springframework.boot:spring-boot-starter-test') + compile('mysql:mysql-connector-java') } diff --git a/users/src/main/resources/application.properties b/users/src/main/resources/application.properties index 91f7491..a96fb20 100644 --- a/users/src/main/resources/application.properties +++ b/users/src/main/resources/application.properties @@ -1 +1,5 @@ -server.port = 8090 \ No newline at end of file +server.port = 8090 +spring.datasource.url = jdbc:mysql://localhost:3306/users +spring.datasource.username = root +spring.datasource.password = skorpion +spring.jpa.generate-ddl=true \ No newline at end of file