diff --git a/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/README.txt b/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/README.txt new file mode 100644 index 0000000..c0d9942 --- /dev/null +++ b/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/README.txt @@ -0,0 +1,196 @@ + + 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 new file mode 100644 index 0000000..251b102 Binary files /dev/null and b/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/US_export_policy.jar differ diff --git a/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/local_policy.jar b/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/local_policy.jar new file mode 100644 index 0000000..1c58939 Binary files /dev/null and b/PhotoAppAPIConfigServer/UnlimitedJCEPolicyJDK8/local_policy.jar differ diff --git a/PhotoAppAPIConfigServer/apiEncryptionKey.jks b/PhotoAppAPIConfigServer/apiEncryptionKey.jks new file mode 100644 index 0000000..dca3810 Binary files /dev/null and b/PhotoAppAPIConfigServer/apiEncryptionKey.jks differ diff --git a/PhotoAppAPIConfigServer/dockerfile b/PhotoAppAPIConfigServer/dockerfile new file mode 100644 index 0000000..6e8f070 --- /dev/null +++ b/PhotoAppAPIConfigServer/dockerfile @@ -0,0 +1,6 @@ +FROM openjdk:8-jdk-alpine +VOLUME /tmp +COPY apiEncryptionKey.jks apiEncryptionKey.jks +COPY UnlimitedJCEPolicyJDK8/* /usr/lib/jvm/java-1.8-openjdk/jre/lib/security/ +COPY target/PhotoAppAPIConfigServer-0.0.1-SNAPSHOT.jar ConfigServer.jar +ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","ConfigServer.jar"] \ No newline at end of file diff --git a/PhotoAppAPIConfigServer/src/main/resources/application.properties b/PhotoAppAPIConfigServer/src/main/resources/application.properties index ab8c695..892f1c7 100644 --- a/PhotoAppAPIConfigServer/src/main/resources/application.properties +++ b/PhotoAppAPIConfigServer/src/main/resources/application.properties @@ -2,13 +2,14 @@ spring.application.name=PhotoAppAPIConfigServer server.port=8012 spring.profiles.active=native -spring.cloud.config.server.native.searchLocations=file://${user.home}/Desktop/dev +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.clone-on-start=true - +spring.cloud.config.server.git.force-pull=true +spring.cloud.config.server.git.searchPaths=usersws,zuul management.endpoints.web.exposure.include=bus-refresh diff --git a/PhotoAppApiAlbums/.gitignore b/PhotoAppApiAlbums/.gitignore new file mode 100644 index 0000000..82eca33 --- /dev/null +++ b/PhotoAppApiAlbums/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/PhotoAppApiAlbums/.mvn/wrapper/maven-wrapper.jar b/PhotoAppApiAlbums/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..01e6799 Binary files /dev/null and b/PhotoAppApiAlbums/.mvn/wrapper/maven-wrapper.jar differ diff --git a/PhotoAppApiAlbums/.mvn/wrapper/maven-wrapper.properties b/PhotoAppApiAlbums/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..7179346 --- /dev/null +++ b/PhotoAppApiAlbums/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip diff --git a/PhotoAppApiAlbums/dockerfile b/PhotoAppApiAlbums/dockerfile new file mode 100644 index 0000000..e6cb83f --- /dev/null +++ b/PhotoAppApiAlbums/dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:8-jdk-alpine +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/mvnw b/PhotoAppApiAlbums/mvnw new file mode 100755 index 0000000..5551fde --- /dev/null +++ b/PhotoAppApiAlbums/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/PhotoAppApiAlbums/mvnw.cmd b/PhotoAppApiAlbums/mvnw.cmd new file mode 100644 index 0000000..e5cfb0a --- /dev/null +++ b/PhotoAppApiAlbums/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/PhotoAppApiAlbums/pom.xml b/PhotoAppApiAlbums/pom.xml new file mode 100644 index 0000000..910cdf9 --- /dev/null +++ b/PhotoAppApiAlbums/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.2.RELEASE + + + com.appsdeveloperblog.photoapp.api.albums + PhotoAppApiAlbums + 0.0.1-SNAPSHOT + PhotoAppApiAlbums + Demo project for Spring Boot + + + 1.8 + Greenwich.RELEASE + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + + org.springframework.boot + spring-boot-devtools + true + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.modelmapper + modelmapper + 2.0.0 + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/PhotoAppApiAlbumsApplication.java b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/PhotoAppApiAlbumsApplication.java new file mode 100644 index 0000000..5d3eec5 --- /dev/null +++ b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/PhotoAppApiAlbumsApplication.java @@ -0,0 +1,16 @@ +package com.appsdeveloperblog.photoapp.api.albums; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +@SpringBootApplication +@EnableDiscoveryClient +public class PhotoAppApiAlbumsApplication { + + public static void main(String[] args) { + SpringApplication.run(PhotoAppApiAlbumsApplication.class, args); + } + +} + diff --git a/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/data/AlbumEntity.java b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/data/AlbumEntity.java new file mode 100644 index 0000000..8919709 --- /dev/null +++ b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/data/AlbumEntity.java @@ -0,0 +1,86 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.appsdeveloperblog.photoapp.api.albums.data; + +public class AlbumEntity { + private long id; + private String albumId; + private String userId; + private String name; + private String description; + + /** + * @return the id + */ + public long getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(long id) { + this.id = id; + } + + /** + * @return the albumId + */ + public String getAlbumId() { + return albumId; + } + + /** + * @param albumId the albumId to set + */ + public void setAlbumId(String albumId) { + this.albumId = albumId; + } + + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + +} diff --git a/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/io/controllers/AlbumsController.java b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/io/controllers/AlbumsController.java new file mode 100644 index 0000000..31eefc4 --- /dev/null +++ b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/io/controllers/AlbumsController.java @@ -0,0 +1,53 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.appsdeveloperblog.photoapp.api.albums.io.controllers; + +import com.appsdeveloperblog.photoapp.api.albums.data.AlbumEntity; +import com.appsdeveloperblog.photoapp.api.albums.service.AlbumsService; +import com.appsdeveloperblog.photoapp.api.albums.ui.model.AlbumResponseModel; +import java.util.ArrayList; +import java.util.List; +import org.modelmapper.ModelMapper; +import java.lang.reflect.Type; +import org.modelmapper.TypeToken; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +@RestController +@RequestMapping("/users/{id}/albums") +public class AlbumsController { + + @Autowired + AlbumsService albumsService; + Logger logger = LoggerFactory.getLogger(this.getClass()); + @GetMapping( + produces = { + MediaType.APPLICATION_JSON_VALUE, + MediaType.APPLICATION_XML_VALUE, + }) + public List userAlbums(@PathVariable String id) { + + List returnValue = new ArrayList<>(); + + List albumsEntities = albumsService.getAlbums(id); + + if(albumsEntities == null || albumsEntities.isEmpty()) + { + return returnValue; + } + + Type listType = new TypeToken>(){}.getType(); + + returnValue = new ModelMapper().map(albumsEntities, listType); + logger.info("Returning " + returnValue.size() + " albums"); + return returnValue; + } +} diff --git a/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/service/AlbumsService.java b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/service/AlbumsService.java new file mode 100644 index 0000000..29e4df6 --- /dev/null +++ b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/service/AlbumsService.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.appsdeveloperblog.photoapp.api.albums.service; + + +import com.appsdeveloperblog.photoapp.api.albums.data.AlbumEntity; +import java.util.List; + +public interface AlbumsService { + List getAlbums(String userId); +} diff --git a/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/service/AlbumsServiceImpl.java b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/service/AlbumsServiceImpl.java new file mode 100644 index 0000000..5fdc4d6 --- /dev/null +++ b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/service/AlbumsServiceImpl.java @@ -0,0 +1,40 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.appsdeveloperblog.photoapp.api.albums.service; + +import com.appsdeveloperblog.photoapp.api.albums.data.AlbumEntity; +import java.util.ArrayList; +import java.util.List; +import org.springframework.stereotype.Service; + +@Service +public class AlbumsServiceImpl implements AlbumsService { + + @Override + public List getAlbums(String userId) { + List returnValue = new ArrayList<>(); + + AlbumEntity albumEntity = new AlbumEntity(); + albumEntity.setUserId(userId); + albumEntity.setAlbumId("album1Id"); + albumEntity.setDescription("album 1 description"); + albumEntity.setId(1L); + albumEntity.setName("album 1 name"); + + AlbumEntity albumEntity2 = new AlbumEntity(); + albumEntity2.setUserId(userId); + albumEntity2.setAlbumId("album2Id"); + albumEntity2.setDescription("album 2 description"); + albumEntity2.setId(2L); + albumEntity2.setName("album 2 name"); + + returnValue.add(albumEntity); + returnValue.add(albumEntity2); + + return returnValue; + } + +} diff --git a/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/ui/model/AlbumResponseModel.java b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/ui/model/AlbumResponseModel.java new file mode 100644 index 0000000..9daa08c --- /dev/null +++ b/PhotoAppApiAlbums/src/main/java/com/appsdeveloperblog/photoapp/api/albums/ui/model/AlbumResponseModel.java @@ -0,0 +1,74 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.appsdeveloperblog.photoapp.api.albums.ui.model; + +/** + * + * @author skargopolov + */ +public class AlbumResponseModel { + private String albumId; + private String userId; + private String name; + private String description; + + /** + * @return the id + */ + public String getAlbumId() { + return albumId; + } + + /** + * @param albumId the albumId to set + */ + public void setAlbumId(String albumId) { + this.albumId = albumId; + } + + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/PhotoAppApiAlbums/src/main/resources/application.properties b/PhotoAppApiAlbums/src/main/resources/application.properties new file mode 100644 index 0000000..58920d0 --- /dev/null +++ b/PhotoAppApiAlbums/src/main/resources/application.properties @@ -0,0 +1,9 @@ +server.port=${PORT:0} +spring.application.name=albums-ws + +eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka +eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}} + +spring.devtools.restart.enabled = true + +logging.file=albums-ws.log diff --git a/PhotoAppApiAlbums/src/test/java/com/appsdeveloperblog/photoapp/api/albums/PhotoAppApiAlbums/PhotoAppApiAlbumsApplicationTests.java b/PhotoAppApiAlbums/src/test/java/com/appsdeveloperblog/photoapp/api/albums/PhotoAppApiAlbums/PhotoAppApiAlbumsApplicationTests.java new file mode 100644 index 0000000..041760a --- /dev/null +++ b/PhotoAppApiAlbums/src/test/java/com/appsdeveloperblog/photoapp/api/albums/PhotoAppApiAlbums/PhotoAppApiAlbumsApplicationTests.java @@ -0,0 +1,17 @@ +package com.appsdeveloperblog.photoapp.api.albums.PhotoAppApiAlbums; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class PhotoAppApiAlbumsApplicationTests { + + @Test + public void contextLoads() { + } + +} + diff --git a/PhotoAppApiUsers/dockerfile b/PhotoAppApiUsers/dockerfile new file mode 100644 index 0000000..681057d --- /dev/null +++ b/PhotoAppApiUsers/dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:8-jdk-alpine +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 df780c6..614c729 100644 --- a/PhotoAppApiUsers/pom.xml +++ b/PhotoAppApiUsers/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.3.RELEASE + 2.1.4.RELEASE com.appsdeveloperblog.photoapp.api.users 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 8105b5a..d8ec5f4 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 @@ -1,5 +1,6 @@ package com.appsdeveloperblog.photoapp.api.users; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; @@ -7,6 +8,8 @@ import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Profile; +import org.springframework.core.env.Environment; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.web.client.RestTemplate; @@ -20,6 +23,9 @@ @EnableCircuitBreaker public class PhotoAppApiUsersApplication { + @Autowired + Environment environment; + public static void main(String[] args) { SpringApplication.run(PhotoAppApiUsersApplication.class, args); } @@ -38,10 +44,40 @@ public RestTemplate getRestTemplate() } @Bean + @Profile("production") Logger.Level feignLoggerLevel() + { + return Logger.Level.NONE; + } + + @Bean + @Profile("!production") + Logger.Level feignDefaultLoggerLevel() { return Logger.Level.FULL; } + + @Bean + @Profile("production") + public String createProductionBean() { + System.out.println("Production bean created. myapplication.environment = " + environment.getProperty("myapplication.environment")); + return "Production bean"; + } + + @Bean + @Profile("!production") + public String createNotProductionBean() { + System.out.println("Not Production bean created. myapplication.environment = " + environment.getProperty("myapplication.environment")); + return "Not production bean"; + } + + @Bean + @Profile("default") + public String createDevelopmentBean() { + System.out.println("Development bean created. myapplication.environment = " + environment.getProperty("myapplication.environment")); + return "Development bean"; + } + /* @Bean public FeignErrorDecoder getFeignErrorDecoder() diff --git a/PhotoAppApiUsers/src/main/resources/application-production.properties b/PhotoAppApiUsers/src/main/resources/application-production.properties new file mode 100644 index 0000000..c18fe27 --- /dev/null +++ b/PhotoAppApiUsers/src/main/resources/application-production.properties @@ -0,0 +1,37 @@ +server.port=${PORT:0} +spring.application.name=users-ws +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}} + +spring.h2.console.enabled=true +spring.h2.console.settings.web-allow-others=true + +#spring.datasource.url=jdbc:mysql://localhost:3306/photo_app?serverTimezone=UTC +#spring.datasource.username=sergey +#spring.datasource.password=sergey +spring.jpa.hibernate.ddl-auto=update + +gateway.ip = 192.168.2.81 +token.expiration_time = 864000000 +token.secret = hfgry463hf746hf573ydh475fhy5739 +login.url.path = /users/login + + +spring.rabbitmq.host=localhost +spring.rabbitmq.port=5672 +spring.rabbitmq.username=guest +spring.rabbitmq.password=guest + +management.endpoints.web.exposure.include=mappings + +logging.level.com.appsdeveloperblog.photoapp.api.users.data.AlbumsServiceClient=DEBUG + +feign.hystrix.enabled=true + +spring.zipkin.base-url=http://localhost:9411 +spring.zipkin.sender.type=web +spring.sleuth.sampler.probability=1 + +logging.file=users-ws.log +myapplication.environment=production profile diff --git a/PhotoAppApiUsers/src/main/resources/application.properties b/PhotoAppApiUsers/src/main/resources/application.properties index d569957..05ccc2b 100644 --- a/PhotoAppApiUsers/src/main/resources/application.properties +++ b/PhotoAppApiUsers/src/main/resources/application.properties @@ -7,12 +7,12 @@ eureka.instance.instance-id=${spring.application.name}:${spring.application.inst spring.h2.console.enabled=true spring.h2.console.settings.web-allow-others=true -spring.datasource.url=jdbc:mysql://localhost:3306/photo_app?serverTimezone=UTC -spring.datasource.username=sergey -spring.datasource.password=sergey +#spring.datasource.url=jdbc:mysql://localhost:3306/photo_app?serverTimezone=UTC +#spring.datasource.username=sergey +#spring.datasource.password=sergey spring.jpa.hibernate.ddl-auto=update -gateway.ip = 192.168.2.81 +gateway.ip = 192.168.1.131 token.expiration_time = 864000000 token.secret = hfgry463hf746hf573ydh475fhy5739 login.url.path = /users/login @@ -34,3 +34,4 @@ spring.zipkin.sender.type=web spring.sleuth.sampler.probability=1 logging.file=users-ws.log +myapplication.environment=development profile diff --git a/PhotoAppApiZuulAPIGateway/dockerfile b/PhotoAppApiZuulAPIGateway/dockerfile new file mode 100644 index 0000000..1b39a5b --- /dev/null +++ b/PhotoAppApiZuulAPIGateway/dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:8-jdk-alpine +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/PhotoAppDiscoveryService/dockerfile b/PhotoAppDiscoveryService/dockerfile new file mode 100644 index 0000000..e99b324 --- /dev/null +++ b/PhotoAppDiscoveryService/dockerfile @@ -0,0 +1,3 @@ +FROM openjdk:8-jdk-alpine +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 c3df2cb..967eafc 100644 --- a/PhotoAppDiscoveryService/pom.xml +++ b/PhotoAppDiscoveryService/pom.xml @@ -1,14 +1,15 @@ - 4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.3.RELEASE - + - + com.appsdeveloperblog.photoapp.discovery PhotoAppDiscoveryService 0.0.1-SNAPSHOT @@ -29,6 +30,11 @@ org.springframework.cloud spring-cloud-starter-netflix-eureka-server + + + org.springframework.boot + spring-boot-starter-security + org.springframework.boot spring-boot-starter-test diff --git a/PhotoAppDiscoveryService/src/main/java/com/appsdeveloperblog/photoapp/discovery/WebSecurity.java b/PhotoAppDiscoveryService/src/main/java/com/appsdeveloperblog/photoapp/discovery/WebSecurity.java new file mode 100644 index 0000000..c280a47 --- /dev/null +++ b/PhotoAppDiscoveryService/src/main/java/com/appsdeveloperblog/photoapp/discovery/WebSecurity.java @@ -0,0 +1,21 @@ +package com.appsdeveloperblog.photoapp.discovery; + +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@EnableWebSecurity +public class WebSecurity extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .csrf() + .disable() + .authorizeRequests() + .anyRequest().authenticated() + .and() + .httpBasic(); + } + +} diff --git a/PhotoAppDiscoveryService/src/main/resources/bootstrap.properties b/PhotoAppDiscoveryService/src/main/resources/bootstrap.properties new file mode 100644 index 0000000..3d59a85 --- /dev/null +++ b/PhotoAppDiscoveryService/src/main/resources/bootstrap.properties @@ -0,0 +1,4 @@ +spring.cloud.config.uri=http://localhost:8012 +spring.cloud.config.name=discoveryservice +spring.security.user.name=test +spring.security.user.password=test \ No newline at end of file