diff --git a/.gitignore b/.gitignore index a2a3040aa86debfd8826d9c2b5c816314c17d9fe..8362df23bb74cd39699a2ec944b1cb8d10f564f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ HELP.md target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/** -!**/src/test/** +.mvn +.idea +/mvn* ### STS ### .apt_generated diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index 7f91a56ea77140c9ce37cf021b452dba21b632af..0000000000000000000000000000000000000000 --- a/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,114 +0,0 @@ -/* -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 - - https://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. -*/ - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URL; -import java.nio.channels.Channels; -import java.nio.channels.ReadableByteChannel; -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = - "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 01e67997377a393fd672c7dcde9dccbedf0cb1e9..0000000000000000000000000000000000000000 Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index cd0d451ccd6fc835996c9fe4eebf8a571154f515..0000000000000000000000000000000000000000 --- a/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/README-ENGLISH.md b/README-ENGLISH.md deleted file mode 100644 index b7d767819777e75aa2b1f95e753f05e9af594b83..0000000000000000000000000000000000000000 --- a/README-ENGLISH.md +++ /dev/null @@ -1,44 +0,0 @@ -# spring-security-jwt-guide - -## Introduce - -[Spring Security](https://spring.io/projects/spring-security ) is a very powerful framework in the Spring family for authentication and permission control, and we can easily extend it to meet our current system security requirements. - -However, compared with some other technologies such as JPA, Spring Security is more difficult to get started. Many people can hardly write a Demo independently after reading video or sending documents, so they may give up learning this thing later. - -Spring Security, a powerful Security authentication framework, has been used in the induction training practical project when I first came to the company and the projects I am working on now. It can be seen that this framework is a good choice in the field of authentication and permission authentication. I am not familiar with Spring Security because I did not make this part of the module of the previous project by myself. So I took the time to learn this part of knowledge and implemented a simple Demo. This Demo mainly USES **Spring Security** and **Spring Boot**, and all the dependencies adopt the latest stable version. Beyond the initial project, the JPA technology was also used. The code structure of the project is as follows (chrome plug-in: octree), which is relatively clear as a whole. Due to my limited ability and time, there must be a lot of areas that can be optimized. Interested friends can improve it together. - -## Setup - -1. git clone https://github.com/Snailclimb/spring-security-jwt-guide.git -2. open project and wait maven to install project Dependencies -3. change `application.properties` change the database connection information parameter to your own -4. Run the project (related data tables will be created automatically, if you don't understand, take a look at JPA) - -## Example - -### 1.Register an account - -![Register](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-7/1-register.png) - -### 2.Login - -![Login](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-7/2-login.png) - -### 3.Access resources that require authentication with the correct token - -![Access resources that require authentication](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-7/3-visit-authenticated-resourse-have-token.png) - -### 4.Access resources that require authentication without token - -![Access resources that require authentication without token](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-7/4-visit-authenticated-resourse-not-have-token.png) - -### 5.Access resources that require authentication with not correct token - -![Access resources that require authentication with not correct token](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-7/5-visit-authenticated-resourse-not-have-valid-token.png) - - - -## Reference - -- https://dev.to/keysh/spring-security-with-jwt-3j76 \ No newline at end of file diff --git a/README.md b/README.md index 0bc789cade4bd13db76b2cfdb3a9f515e0f9f576..c7e8a86a8f381d0af1b5f23a59c6b9722714a7d3 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,10 @@ - **缓存**: Redis - **权限框架** :Spring Security - **ORM框架** :JPA (低SQL) -- **接口文档** : swagger。在线 API 文档地址:[http://localhost:9333/api/swagger-ui/](http://localhost:9333/api/swagger-ui/) 。目前使用 knife4j 增强了 swagger 功能,地址: [http://localhost:9333/api/doc.html](http://localhost:9333/api/doc.html) (推荐👍) +- **接口文档** : + - swagger。在线 API 文档地址:[http://localhost:9333/api/swagger-ui/](http://localhost:9333/api/swagger-ui/) + - 目前使用 knife4j 增强了 swagger 功能, + 地址: [http://localhost:9333/api/doc.html](http://localhost:9333/api/doc.html) (推荐👍) **你能从这个项目中学习到什么?** @@ -91,7 +94,7 @@ ``` ![登录](./pictures/login.png) - +******** ### 3.使用正确 Token 访问需要进行身份验证的资源 diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml deleted file mode 100644 index 6eb46cf47f81603277a36cecdd95f2d34638c2c4..0000000000000000000000000000000000000000 --- a/config/checkstyle/checkstyle.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/docs/H2\345\206\205\345\255\230\346\225\260\346\215\256\345\272\223\344\273\213\347\273\215.md" "b/docs/H2\345\206\205\345\255\230\346\225\260\346\215\256\345\272\223\344\273\213\347\273\215.md" index a2c6ad40163ffab88facc380c704fb505b1af795..d2efe7c4115f3fc46252bdf3a4370fdec45777aa 100644 --- "a/docs/H2\345\206\205\345\255\230\346\225\260\346\215\256\345\272\223\344\273\213\347\273\215.md" +++ "b/docs/H2\345\206\205\345\255\230\346\225\260\346\215\256\345\272\223\344\273\213\347\273\215.md" @@ -6,6 +6,4 @@ H2是用Java编写的内存数据库。 因为是内存数据库,所以h2的速度比一般的关系型数据库快很多,一般用于单元测试环境。 - - ![](../pictures/h2-collection.png) \ No newline at end of file diff --git a/pictures/access-resources-that-require-authentication.png b/docs/pictures/access-resources-that-require-authentication.png similarity index 100% rename from pictures/access-resources-that-require-authentication.png rename to docs/pictures/access-resources-that-require-authentication.png diff --git a/pictures/access-resources-that-require-authentication2.png b/docs/pictures/access-resources-that-require-authentication2.png similarity index 100% rename from pictures/access-resources-that-require-authentication2.png rename to docs/pictures/access-resources-that-require-authentication2.png diff --git a/pictures/h2-collection.png b/docs/pictures/h2-collection.png similarity index 100% rename from pictures/h2-collection.png rename to docs/pictures/h2-collection.png diff --git a/pictures/login.png b/docs/pictures/login.png similarity index 100% rename from pictures/login.png rename to docs/pictures/login.png diff --git a/pictures/not-have-enough-permission.png b/docs/pictures/not-have-enough-permission.png similarity index 100% rename from pictures/not-have-enough-permission.png rename to docs/pictures/not-have-enough-permission.png diff --git a/pictures/sign-up.png b/docs/pictures/sign-up.png similarity index 100% rename from pictures/sign-up.png rename to docs/pictures/sign-up.png diff --git a/pictures/structure.png b/docs/pictures/structure.png similarity index 100% rename from pictures/structure.png rename to docs/pictures/structure.png diff --git "a/pictures/swagger/swagger\345\234\250SpringBoot\344\270\255\347\256\200\345\215\225\344\275\277\347\224\250.png" "b/docs/pictures/swagger/swagger\345\234\250SpringBoot\344\270\255\347\256\200\345\215\225\344\275\277\347\224\250.png" similarity index 100% rename from "pictures/swagger/swagger\345\234\250SpringBoot\344\270\255\347\256\200\345\215\225\344\275\277\347\224\250.png" rename to "docs/pictures/swagger/swagger\345\234\250SpringBoot\344\270\255\347\256\200\345\215\225\344\275\277\347\224\250.png" diff --git "a/pictures/swagger/\344\270\272\350\257\267\346\261\202\347\232\204Header\346\267\273\345\212\240\344\270\200\344\270\252\350\256\244\350\257\201\345\217\202\346\225\260.png" "b/docs/pictures/swagger/\344\270\272\350\257\267\346\261\202\347\232\204Header\346\267\273\345\212\240\344\270\200\344\270\252\350\256\244\350\257\201\345\217\202\346\225\260.png" similarity index 100% rename from "pictures/swagger/\344\270\272\350\257\267\346\261\202\347\232\204Header\346\267\273\345\212\240\344\270\200\344\270\252\350\256\244\350\257\201\345\217\202\346\225\260.png" rename to "docs/pictures/swagger/\344\270\272\350\257\267\346\261\202\347\232\204Header\346\267\273\345\212\240\344\270\200\344\270\252\350\256\244\350\257\201\345\217\202\346\225\260.png" diff --git "a/pictures/swagger/\347\231\273\345\275\225\345\220\216\350\207\252\345\212\250\344\270\272\350\257\267\346\261\202\346\267\273\345\212\240token.png" "b/docs/pictures/swagger/\347\231\273\345\275\225\345\220\216\350\207\252\345\212\250\344\270\272\350\257\267\346\261\202\346\267\273\345\212\240token.png" similarity index 100% rename from "pictures/swagger/\347\231\273\345\275\225\345\220\216\350\207\252\345\212\250\344\270\272\350\257\267\346\261\202\346\267\273\345\212\240token.png" rename to "docs/pictures/swagger/\347\231\273\345\275\225\345\220\216\350\207\252\345\212\250\344\270\272\350\257\267\346\261\202\346\267\273\345\212\240token.png" diff --git "a/pictures/swagger/\350\207\252\345\212\250\346\267\273\345\212\240token-\347\231\273\345\275\225\345\211\215.png" "b/docs/pictures/swagger/\350\207\252\345\212\250\346\267\273\345\212\240token-\347\231\273\345\275\225\345\211\215.png" similarity index 100% rename from "pictures/swagger/\350\207\252\345\212\250\346\267\273\345\212\240token-\347\231\273\345\275\225\345\211\215.png" rename to "docs/pictures/swagger/\350\207\252\345\212\250\346\267\273\345\212\240token-\347\231\273\345\275\225\345\211\215.png" diff --git "a/pictures/swagger/\350\207\252\345\212\250\346\267\273\345\212\240token-\347\231\273\345\275\225\345\220\216.png" "b/docs/pictures/swagger/\350\207\252\345\212\250\346\267\273\345\212\240token-\347\231\273\345\275\225\345\220\216.png" similarity index 100% rename from "pictures/swagger/\350\207\252\345\212\250\346\267\273\345\212\240token-\347\231\273\345\275\225\345\220\216.png" rename to "docs/pictures/swagger/\350\207\252\345\212\250\346\267\273\345\212\240token-\347\231\273\345\275\225\345\220\216.png" diff --git "a/\345\255\246\344\271\240\350\265\204\346\272\220.md" "b/docs/\345\255\246\344\271\240\350\265\204\346\272\220.md" similarity index 100% rename from "\345\255\246\344\271\240\350\265\204\346\272\220.md" rename to "docs/\345\255\246\344\271\240\350\265\204\346\272\220.md" diff --git a/mvnw b/mvnw deleted file mode 100755 index c188654d011cc69a7eb11d74603fd0c997bd10d4..0000000000000000000000000000000000000000 --- a/mvnw +++ /dev/null @@ -1,298 +0,0 @@ -#!/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 -# -# https://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/mvnw.cmd b/mvnw.cmd deleted file mode 100644 index fef5a8f7f98851e698aed89b38961d160db50249..0000000000000000000000000000000000000000 --- a/mvnw.cmd +++ /dev/null @@ -1,161 +0,0 @@ -@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 https://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/src/main/java/github/javaguide/springsecurityjwtguide/SpringSecurityJwtGuideApplication.java b/src/main/java/spring/SpringSecurityJwtApplication.java similarity index 35% rename from src/main/java/github/javaguide/springsecurityjwtguide/SpringSecurityJwtGuideApplication.java rename to src/main/java/spring/SpringSecurityJwtApplication.java index 66185c7caec414ed633c5f40096532859aeafbeb..f228627e929129e23e344b34090cdb05e8b0f98b 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/SpringSecurityJwtGuideApplication.java +++ b/src/main/java/spring/SpringSecurityJwtApplication.java @@ -1,12 +1,12 @@ -package github.javaguide.springsecurityjwtguide; +package spring; -import github.javaguide.springsecurityjwtguide.system.entity.Role; -import github.javaguide.springsecurityjwtguide.system.entity.User; -import github.javaguide.springsecurityjwtguide.system.entity.UserRole; -import github.javaguide.springsecurityjwtguide.system.enums.RoleType; -import github.javaguide.springsecurityjwtguide.system.repository.RoleRepository; -import github.javaguide.springsecurityjwtguide.system.repository.UserRepository; -import github.javaguide.springsecurityjwtguide.system.repository.UserRoleRepository; +import spring.system.entity.Role; +import spring.system.entity.User; +import spring.system.entity.UserRole; +import spring.system.enums.RoleType; +import spring.system.repository.RoleRepository; +import spring.system.repository.UserRepository; +import spring.system.repository.UserRoleRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; @@ -17,7 +17,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; * @author shuang.kou */ @SpringBootApplication -public class SpringSecurityJwtGuideApplication implements CommandLineRunner { +public class SpringSecurityJwtApplication implements CommandLineRunner { @Autowired private RoleRepository roleRepository; @@ -27,20 +27,26 @@ public class SpringSecurityJwtGuideApplication implements CommandLineRunner { private UserRoleRepository userRoleRepository; public static void main(java.lang.String[] args) { - SpringApplication.run(SpringSecurityJwtGuideApplication.class, args); + + SpringApplication.run(SpringSecurityJwtApplication.class, args); } @Override public void run(java.lang.String... args) { //初始化角色信息 - for (RoleType roleType : RoleType.values()) { - roleRepository.save(new Role(roleType.getName(), roleType.getDescription())); + try{ + for (RoleType roleType : RoleType.values()) { + roleRepository.save(new Role(roleType.getName(), roleType.getDescription())); + } + //初始化一个 admin 用户 + BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); + User user = User.builder().enabled(true).fullName("Admin").userName("superman").password(bCryptPasswordEncoder.encode("talent123")).build(); + userRepository.save(user); + Role role = roleRepository.findByName(RoleType.ADMIN.getName()).get(); + userRoleRepository.save(new UserRole(user, role)); + } catch(Exception e){ + System.out.println("已经初始化了用户(下面是错误信息)......"); + System.out.println(e.getMessage().toString()); } - //初始化一个 admin 用户 - BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); - User user = User.builder().enabled(true).fullName("admin").userName("root").password(bCryptPasswordEncoder.encode("root")).build(); - userRepository.save(user); - Role role = roleRepository.findByName(RoleType.ADMIN.getName()).get(); - userRoleRepository.save(new UserRole(user, role)); } } diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/common/constants/SecurityConstants.java b/src/main/java/spring/security/common/constants/SecurityConstants.java similarity index 95% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/common/constants/SecurityConstants.java rename to src/main/java/spring/security/common/constants/SecurityConstants.java index 82a88b7809f2dd10c933bbf698f8c1111476fb39..c85af856c1160db46abfc7264e7348efa9c1a8c5 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/common/constants/SecurityConstants.java +++ b/src/main/java/spring/security/common/constants/SecurityConstants.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.security.common.constants; +package spring.security.common.constants; /** * @author shuang.kou diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/common/utils/CurrentUserUtils.java b/src/main/java/spring/security/common/utils/CurrentUserUtils.java similarity index 81% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/common/utils/CurrentUserUtils.java rename to src/main/java/spring/security/common/utils/CurrentUserUtils.java index 8ab33d63272e5b88395a0f239e57185f61caba7d..41bd84401931c4eda8cdd0369349968f677b3d01 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/common/utils/CurrentUserUtils.java +++ b/src/main/java/spring/security/common/utils/CurrentUserUtils.java @@ -1,7 +1,7 @@ -package github.javaguide.springsecurityjwtguide.security.common.utils; +package spring.security.common.utils; -import github.javaguide.springsecurityjwtguide.system.entity.User; -import github.javaguide.springsecurityjwtguide.system.service.UserService; +import spring.system.entity.User; +import spring.system.service.UserService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/common/utils/JwtTokenUtils.java b/src/main/java/spring/security/common/utils/JwtTokenUtils.java similarity index 94% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/common/utils/JwtTokenUtils.java rename to src/main/java/spring/security/common/utils/JwtTokenUtils.java index 8341433dcc533905dd793c6caa55d81d64940323..582b8da37c9e9602b91128828e76c14d5554391f 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/common/utils/JwtTokenUtils.java +++ b/src/main/java/spring/security/common/utils/JwtTokenUtils.java @@ -1,6 +1,6 @@ -package github.javaguide.springsecurityjwtguide.security.common.utils; +package spring.security.common.utils; -import github.javaguide.springsecurityjwtguide.security.common.constants.SecurityConstants; +import spring.security.common.constants.SecurityConstants; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/config/AuditSecurityConfiguration.java b/src/main/java/spring/security/config/AuditSecurityConfiguration.java similarity index 93% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/config/AuditSecurityConfiguration.java rename to src/main/java/spring/security/config/AuditSecurityConfiguration.java index 1b5a0b034505e73c8dbcf3b24de2b0210849e2a7..268bab472ca0225052e9504b18e8640e0dc6acb6 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/config/AuditSecurityConfiguration.java +++ b/src/main/java/spring/security/config/AuditSecurityConfiguration.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.security.config; +package spring.security.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/config/SecurityConfiguration.java b/src/main/java/spring/security/config/SecurityConfiguration.java similarity index 89% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/config/SecurityConfiguration.java rename to src/main/java/spring/security/config/SecurityConfiguration.java index 509d853457fca8b5836d5b38fc041028243e04bf..0e789e3bd21c92097989a4c519a0f6816a9570a8 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/config/SecurityConfiguration.java +++ b/src/main/java/spring/security/config/SecurityConfiguration.java @@ -1,9 +1,9 @@ -package github.javaguide.springsecurityjwtguide.security.config; +package spring.security.config; -import github.javaguide.springsecurityjwtguide.security.common.constants.SecurityConstants; -import github.javaguide.springsecurityjwtguide.security.exception.JwtAccessDeniedHandler; -import github.javaguide.springsecurityjwtguide.security.exception.JwtAuthenticationEntryPoint; -import github.javaguide.springsecurityjwtguide.security.filter.JwtAuthorizationFilter; +import spring.security.common.constants.SecurityConstants; +import spring.security.exception.JwtAccessDeniedHandler; +import spring.security.exception.JwtAuthenticationEntryPoint; +import spring.security.filter.JwtAuthorizationFilter; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.http.HttpMethod; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/controller/AuthController.java b/src/main/java/spring/security/controller/AuthController.java similarity index 81% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/controller/AuthController.java rename to src/main/java/spring/security/controller/AuthController.java index ab1b2a7c5c14806709cfc9acb5863448d4c422c4..cb4d824221070e3faab8a987c3a4dd73227c0136 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/controller/AuthController.java +++ b/src/main/java/spring/security/controller/AuthController.java @@ -1,8 +1,8 @@ -package github.javaguide.springsecurityjwtguide.security.controller; +package spring.security.controller; -import github.javaguide.springsecurityjwtguide.security.common.constants.SecurityConstants; -import github.javaguide.springsecurityjwtguide.security.dto.LoginRequest; -import github.javaguide.springsecurityjwtguide.security.service.AuthService; +import spring.security.common.constants.SecurityConstants; +import spring.security.dto.LoginRequest; +import spring.security.service.AuthService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/dto/LoginRequest.java b/src/main/java/spring/security/dto/LoginRequest.java similarity index 81% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/dto/LoginRequest.java rename to src/main/java/spring/security/dto/LoginRequest.java index 5dda95bc85c8c1d647fec3e158164826320355f9..3dfc8e4c7ed39b0075e94772d20fbc7edeacd12a 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/dto/LoginRequest.java +++ b/src/main/java/spring/security/dto/LoginRequest.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.security.dto; +package spring.security.dto; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/entity/JwtUser.java b/src/main/java/spring/security/entity/JwtUser.java similarity index 92% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/entity/JwtUser.java rename to src/main/java/spring/security/entity/JwtUser.java index 3dc08d62350984bd1463c3f35da3634e67168b2c..cf006d44f24bee1805df129db674a187cf46e111 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/entity/JwtUser.java +++ b/src/main/java/spring/security/entity/JwtUser.java @@ -1,6 +1,6 @@ -package github.javaguide.springsecurityjwtguide.security.entity; +package spring.security.entity; -import github.javaguide.springsecurityjwtguide.system.entity.User; +import spring.system.entity.User; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/exception/JwtAccessDeniedHandler.java b/src/main/java/spring/security/exception/JwtAccessDeniedHandler.java similarity index 93% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/exception/JwtAccessDeniedHandler.java rename to src/main/java/spring/security/exception/JwtAccessDeniedHandler.java index 3197066e7229340f815fb90c782e33a1b1aeec58..91883cb85550f3a98c0e3d235f7348ef867c911c 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/exception/JwtAccessDeniedHandler.java +++ b/src/main/java/spring/security/exception/JwtAccessDeniedHandler.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.security.exception; +package spring.security.exception; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.web.access.AccessDeniedHandler; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/exception/JwtAuthenticationEntryPoint.java b/src/main/java/spring/security/exception/JwtAuthenticationEntryPoint.java similarity index 93% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/exception/JwtAuthenticationEntryPoint.java rename to src/main/java/spring/security/exception/JwtAuthenticationEntryPoint.java index 8862b4d9d3b9dd6c7fd2bcc028e40622f281921f..65c2b15e3031f704cf0228257e8c22a057958a8b 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/exception/JwtAuthenticationEntryPoint.java +++ b/src/main/java/spring/security/exception/JwtAuthenticationEntryPoint.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.security.exception; +package spring.security.exception; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/filter/JwtAuthorizationFilter.java b/src/main/java/spring/security/filter/JwtAuthorizationFilter.java similarity index 91% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/filter/JwtAuthorizationFilter.java rename to src/main/java/spring/security/filter/JwtAuthorizationFilter.java index 81684c8a879f5a314f02cf0ca524f7453ff57ba6..9e49be2273d273e4be4ffcfe54496b3b4b7f8444 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/filter/JwtAuthorizationFilter.java +++ b/src/main/java/spring/security/filter/JwtAuthorizationFilter.java @@ -1,7 +1,7 @@ -package github.javaguide.springsecurityjwtguide.security.filter; +package spring.security.filter; -import github.javaguide.springsecurityjwtguide.security.common.constants.SecurityConstants; -import github.javaguide.springsecurityjwtguide.security.common.utils.JwtTokenUtils; +import spring.security.common.constants.SecurityConstants; +import spring.security.common.utils.JwtTokenUtils; import io.jsonwebtoken.JwtException; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.StringRedisTemplate; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/security/service/AuthService.java b/src/main/java/spring/security/service/AuthService.java similarity index 76% rename from src/main/java/github/javaguide/springsecurityjwtguide/security/service/AuthService.java rename to src/main/java/spring/security/service/AuthService.java index 43e24eecf2c7cfaa2c47a4b3daae43611b1ccd9e..9abe3d35a187f7279cf9ddf5cce5646454fad54f 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/security/service/AuthService.java +++ b/src/main/java/spring/security/service/AuthService.java @@ -1,11 +1,11 @@ -package github.javaguide.springsecurityjwtguide.security.service; +package spring.security.service; -import github.javaguide.springsecurityjwtguide.security.common.utils.CurrentUserUtils; -import github.javaguide.springsecurityjwtguide.security.common.utils.JwtTokenUtils; -import github.javaguide.springsecurityjwtguide.security.dto.LoginRequest; -import github.javaguide.springsecurityjwtguide.security.entity.JwtUser; -import github.javaguide.springsecurityjwtguide.system.entity.User; -import github.javaguide.springsecurityjwtguide.system.service.UserService; +import spring.security.common.utils.CurrentUserUtils; +import spring.security.common.utils.JwtTokenUtils; +import spring.security.dto.LoginRequest; +import spring.security.entity.JwtUser; +import spring.system.entity.User; +import spring.system.service.UserService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/config/RedisConfig.java b/src/main/java/spring/system/config/RedisConfig.java similarity index 90% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/config/RedisConfig.java rename to src/main/java/spring/system/config/RedisConfig.java index 02801724bb5bf3b9b926adcf52f408c17efe377c..3928e51d892afd1ee1fb294412ea10536be1fdf1 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/config/RedisConfig.java +++ b/src/main/java/spring/system/config/RedisConfig.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.config; +package spring.system.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/config/SwaggerConfig.java b/src/main/java/spring/system/config/SwaggerConfig.java similarity index 93% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/config/SwaggerConfig.java rename to src/main/java/spring/system/config/SwaggerConfig.java index e61926e3bc2d8677fd2e961306c7f306113b31a5..b26ccd341b2ee27b7bf10431fb0d579cb338c42e 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/config/SwaggerConfig.java +++ b/src/main/java/spring/system/config/SwaggerConfig.java @@ -1,6 +1,6 @@ -package github.javaguide.springsecurityjwtguide.system.config; +package spring.system.config; -import github.javaguide.springsecurityjwtguide.security.common.constants.SecurityConstants; +import spring.security.common.constants.SecurityConstants; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/entity/AbstractAuditBase.java b/src/main/java/spring/system/entity/AbstractAuditBase.java similarity index 94% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/entity/AbstractAuditBase.java rename to src/main/java/spring/system/entity/AbstractAuditBase.java index 6e724afb34983bfd883f491da2fa57c85d5ff9f2..21f25b1c55a8caa49e5afc3436264dc9f51ff9d1 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/entity/AbstractAuditBase.java +++ b/src/main/java/spring/system/entity/AbstractAuditBase.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.entity; +package spring.system.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/entity/Role.java b/src/main/java/spring/system/entity/Role.java similarity index 93% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/entity/Role.java rename to src/main/java/spring/system/entity/Role.java index 3868d39b1928362652fff715c5eca5b39983e373..a14763109ba9616fad9ceb82fc256485c093dbc2 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/entity/Role.java +++ b/src/main/java/spring/system/entity/Role.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.entity; +package spring.system.entity; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/entity/User.java b/src/main/java/spring/system/entity/User.java similarity index 92% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/entity/User.java rename to src/main/java/spring/system/entity/User.java index 177f7d63941ed72b27bf0a0b5f89b0a3c6ceb00e..877ab8ace8d19898111a2311148af1929a23cab0 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/entity/User.java +++ b/src/main/java/spring/system/entity/User.java @@ -1,7 +1,7 @@ -package github.javaguide.springsecurityjwtguide.system.entity; +package spring.system.entity; import com.fasterxml.jackson.annotation.JsonIgnore; -import github.javaguide.springsecurityjwtguide.system.web.representation.UserRepresentation; +import spring.system.web.representation.UserRepresentation; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/entity/UserRole.java b/src/main/java/spring/system/entity/UserRole.java similarity index 92% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/entity/UserRole.java rename to src/main/java/spring/system/entity/UserRole.java index 58687543fab75d1cb7b84f8231c06be4e33d5bfe..8f4f71e08bda96ebec8694eb68fa488c69cf2f73 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/entity/UserRole.java +++ b/src/main/java/spring/system/entity/UserRole.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.entity; +package spring.system.entity; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/enums/RoleType.java b/src/main/java/spring/system/enums/RoleType.java similarity index 87% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/enums/RoleType.java rename to src/main/java/spring/system/enums/RoleType.java index 424b0b14e19ecae98120de70667688013112baec..3aced210af9e79d77c626ad75c892dde6d8ab233 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/enums/RoleType.java +++ b/src/main/java/spring/system/enums/RoleType.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.enums; +package spring.system.enums; import lombok.Getter; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/BaseException.java b/src/main/java/spring/system/exception/BaseException.java similarity index 93% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/exception/BaseException.java rename to src/main/java/spring/system/exception/BaseException.java index c46107eb12df375ab269f15512d1e6bf7384b13e..a3a9167ad6599ce18f0a4b9e36c8b22e69364910 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/BaseException.java +++ b/src/main/java/spring/system/exception/BaseException.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.exception; +package spring.system.exception; import org.springframework.util.ObjectUtils; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/ErrorCode.java b/src/main/java/spring/system/exception/ErrorCode.java similarity index 91% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/exception/ErrorCode.java rename to src/main/java/spring/system/exception/ErrorCode.java index 76d0e52cdc9da68660601b00b693ac061366cb7d..9a96be8830977419c10553bdd96f7accb857181f 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/ErrorCode.java +++ b/src/main/java/spring/system/exception/ErrorCode.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.exception; +package spring.system.exception; import lombok.Getter; import org.springframework.http.HttpStatus; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/ErrorResponse.java b/src/main/java/spring/system/exception/ErrorResponse.java similarity index 95% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/exception/ErrorResponse.java rename to src/main/java/spring/system/exception/ErrorResponse.java index dfd71996ee7ed761f45f78dfac3a6e37876126ce..4725215d85e99b7613c559284e4bd36627a721f0 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/ErrorResponse.java +++ b/src/main/java/spring/system/exception/ErrorResponse.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.exception; +package spring.system.exception; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/GlobalExceptionHandler.java b/src/main/java/spring/system/exception/GlobalExceptionHandler.java similarity index 97% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/exception/GlobalExceptionHandler.java rename to src/main/java/spring/system/exception/GlobalExceptionHandler.java index 10705c1a2a8912b1bddd20234cebeb55c0fee058..c6a5a320f838ab04763f61ab59cecd4ed4233551 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/GlobalExceptionHandler.java +++ b/src/main/java/spring/system/exception/GlobalExceptionHandler.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.exception; +package spring.system.exception; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/RoleNotFoundException.java b/src/main/java/spring/system/exception/RoleNotFoundException.java similarity index 77% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/exception/RoleNotFoundException.java rename to src/main/java/spring/system/exception/RoleNotFoundException.java index d56b671790e90cf70db142485732e15e176aaa25..d2af009e2bd30fa8de6eab99135cc0d5dd1f2d00 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/RoleNotFoundException.java +++ b/src/main/java/spring/system/exception/RoleNotFoundException.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.exception; +package spring.system.exception; import java.util.Map; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/UserNameAlreadyExistException.java b/src/main/java/spring/system/exception/UserNameAlreadyExistException.java similarity index 79% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/exception/UserNameAlreadyExistException.java rename to src/main/java/spring/system/exception/UserNameAlreadyExistException.java index 2a7b85e0823b6352cee4331e29a3549b878cc5a2..dadc148711c07480b9716b5397d3842630389040 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/UserNameAlreadyExistException.java +++ b/src/main/java/spring/system/exception/UserNameAlreadyExistException.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.exception; +package spring.system.exception; import java.util.Map; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/UserNameNotFoundException.java b/src/main/java/spring/system/exception/UserNameNotFoundException.java similarity index 78% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/exception/UserNameNotFoundException.java rename to src/main/java/spring/system/exception/UserNameNotFoundException.java index 1eb760b388db94e43442b2c254b8487d6714c2e3..ddc61cd3dbc706200d5cdbd2476d5631c8cbd056 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/exception/UserNameNotFoundException.java +++ b/src/main/java/spring/system/exception/UserNameNotFoundException.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.exception; +package spring.system.exception; import java.util.Map; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/repository/RoleRepository.java b/src/main/java/spring/system/repository/RoleRepository.java similarity index 69% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/repository/RoleRepository.java rename to src/main/java/spring/system/repository/RoleRepository.java index 5da2c789522fd6a76685476c60707da4dce745df..e932ec5b4188b1ef0fcd216a79516044bc92baf5 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/repository/RoleRepository.java +++ b/src/main/java/spring/system/repository/RoleRepository.java @@ -1,6 +1,6 @@ -package github.javaguide.springsecurityjwtguide.system.repository; +package spring.system.repository; -import github.javaguide.springsecurityjwtguide.system.entity.Role; +import spring.system.entity.Role; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/repository/UserRepository.java b/src/main/java/spring/system/repository/UserRepository.java similarity index 81% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/repository/UserRepository.java rename to src/main/java/spring/system/repository/UserRepository.java index e6772888d1ec4c6410a5f406d60ec6ff3c2b9450..11cca080f44cb437a258ea071540f72275b6b321 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/repository/UserRepository.java +++ b/src/main/java/spring/system/repository/UserRepository.java @@ -1,6 +1,6 @@ -package github.javaguide.springsecurityjwtguide.system.repository; +package spring.system.repository; -import github.javaguide.springsecurityjwtguide.system.entity.User; +import spring.system.entity.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.stereotype.Repository; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/repository/UserRoleRepository.java b/src/main/java/spring/system/repository/UserRoleRepository.java similarity index 59% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/repository/UserRoleRepository.java rename to src/main/java/spring/system/repository/UserRoleRepository.java index 3eb5103399ee007c55cecec5e8bf41a3a34ab13f..daa8dcd5d128b4be73da69758dc7f6c1c4838343 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/repository/UserRoleRepository.java +++ b/src/main/java/spring/system/repository/UserRoleRepository.java @@ -1,6 +1,6 @@ -package github.javaguide.springsecurityjwtguide.system.repository; +package spring.system.repository; -import github.javaguide.springsecurityjwtguide.system.entity.UserRole; +import spring.system.entity.UserRole; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/service/UserService.java b/src/main/java/spring/system/service/UserService.java similarity index 75% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/service/UserService.java rename to src/main/java/spring/system/service/UserService.java index adabc82c43ab7f281e0bd0cfe22c431b68d20dd7..82cf4f83e228b3eecfc9296a579e958386888970 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/service/UserService.java +++ b/src/main/java/spring/system/service/UserService.java @@ -1,19 +1,19 @@ -package github.javaguide.springsecurityjwtguide.system.service; +package spring.system.service; import com.google.common.collect.ImmutableMap; -import github.javaguide.springsecurityjwtguide.system.entity.Role; -import github.javaguide.springsecurityjwtguide.system.entity.User; -import github.javaguide.springsecurityjwtguide.system.entity.UserRole; -import github.javaguide.springsecurityjwtguide.system.enums.RoleType; -import github.javaguide.springsecurityjwtguide.system.exception.RoleNotFoundException; -import github.javaguide.springsecurityjwtguide.system.exception.UserNameAlreadyExistException; -import github.javaguide.springsecurityjwtguide.system.exception.UserNameNotFoundException; -import github.javaguide.springsecurityjwtguide.system.repository.RoleRepository; -import github.javaguide.springsecurityjwtguide.system.repository.UserRepository; -import github.javaguide.springsecurityjwtguide.system.repository.UserRoleRepository; -import github.javaguide.springsecurityjwtguide.system.web.representation.UserRepresentation; -import github.javaguide.springsecurityjwtguide.system.web.request.UserRegisterRequest; -import github.javaguide.springsecurityjwtguide.system.web.request.UserUpdateRequest; +import spring.system.entity.Role; +import spring.system.entity.User; +import spring.system.entity.UserRole; +import spring.system.enums.RoleType; +import spring.system.exception.RoleNotFoundException; +import spring.system.exception.UserNameAlreadyExistException; +import spring.system.exception.UserNameNotFoundException; +import spring.system.repository.RoleRepository; +import spring.system.repository.UserRepository; +import spring.system.repository.UserRoleRepository; +import spring.system.web.representation.UserRepresentation; +import spring.system.web.request.UserRegisterRequest; +import spring.system.web.request.UserUpdateRequest; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/validator/FullName.java b/src/main/java/spring/system/validator/FullName.java similarity index 89% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/validator/FullName.java rename to src/main/java/spring/system/validator/FullName.java index d9a3065653b3dc0fbd312d9984e384478e93e7a3..fc869ed300b91e317cc22612e585f50b92928908 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/validator/FullName.java +++ b/src/main/java/spring/system/validator/FullName.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.validator; +package spring.system.validator; import javax.validation.Constraint; import java.lang.annotation.Documented; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/validator/FullNameValidator.java b/src/main/java/spring/system/validator/FullNameValidator.java similarity index 90% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/validator/FullNameValidator.java rename to src/main/java/spring/system/validator/FullNameValidator.java index 5a926e6f46e698a189dde7f81f8647243303b1ae..4ea2b16332eaeab7834d4017a60eecf1f9b0cc2e 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/validator/FullNameValidator.java +++ b/src/main/java/spring/system/validator/FullNameValidator.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.validator; +package spring.system.validator; import javax.validation.ConstraintValidator; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/web/controller/UserController.java b/src/main/java/spring/system/web/controller/UserController.java similarity index 85% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/web/controller/UserController.java rename to src/main/java/spring/system/web/controller/UserController.java index 691597b99fc4333c9de3ca0aff67d75817469314..a3270d892e045350f5a7658ab9b3e3cbccba1142 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/web/controller/UserController.java +++ b/src/main/java/spring/system/web/controller/UserController.java @@ -1,9 +1,9 @@ -package github.javaguide.springsecurityjwtguide.system.web.controller; +package spring.system.web.controller; -import github.javaguide.springsecurityjwtguide.system.service.UserService; -import github.javaguide.springsecurityjwtguide.system.web.representation.UserRepresentation; -import github.javaguide.springsecurityjwtguide.system.web.request.UserRegisterRequest; -import github.javaguide.springsecurityjwtguide.system.web.request.UserUpdateRequest; +import spring.system.service.UserService; +import spring.system.web.representation.UserRepresentation; +import spring.system.web.request.UserRegisterRequest; +import spring.system.web.request.UserUpdateRequest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/web/representation/UserRepresentation.java b/src/main/java/spring/system/web/representation/UserRepresentation.java similarity index 77% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/web/representation/UserRepresentation.java rename to src/main/java/spring/system/web/representation/UserRepresentation.java index 8cba3075a9c8c9be7ccc743f14eb559440795cd5..a3fa6c8d371497086aaf086978178860b16dc979 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/web/representation/UserRepresentation.java +++ b/src/main/java/spring/system/web/representation/UserRepresentation.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.web.representation; +package spring.system.web.representation; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/web/request/UserRegisterRequest.java b/src/main/java/spring/system/web/request/UserRegisterRequest.java similarity index 73% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/web/request/UserRegisterRequest.java rename to src/main/java/spring/system/web/request/UserRegisterRequest.java index fefd9e4f82d3d72ce8b6185a3d8875121a58576f..55f4bf185e7fd17fd32b73cfc92dd8bf743c3b86 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/web/request/UserRegisterRequest.java +++ b/src/main/java/spring/system/web/request/UserRegisterRequest.java @@ -1,8 +1,8 @@ -package github.javaguide.springsecurityjwtguide.system.web.request; +package spring.system.web.request; -import github.javaguide.springsecurityjwtguide.system.entity.User; -import github.javaguide.springsecurityjwtguide.system.validator.FullName; +import spring.system.entity.User; +import spring.system.validator.FullName; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/github/javaguide/springsecurityjwtguide/system/web/request/UserUpdateRequest.java b/src/main/java/spring/system/web/request/UserUpdateRequest.java similarity index 84% rename from src/main/java/github/javaguide/springsecurityjwtguide/system/web/request/UserUpdateRequest.java rename to src/main/java/spring/system/web/request/UserUpdateRequest.java index d5d6e2ac06039781d32d95c6679a1280ebfd1013..ea178be6a4335020e85fbafa0d5a2bc0e3b66c48 100644 --- a/src/main/java/github/javaguide/springsecurityjwtguide/system/web/request/UserUpdateRequest.java +++ b/src/main/java/spring/system/web/request/UserUpdateRequest.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system.web.request; +package spring.system.web.request; import lombok.AllArgsConstructor; diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index f75115229754d3535598a6a32e697b1df59a3cf7..b79675771d70a2ec39cafe45af8820d59b888131 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -4,16 +4,22 @@ server: context-path: /api/ spring: datasource: - driverClassName: org.h2.Driver username: root - password: 123456 - platform: h2 - url: jdbc:h2:mem:jwt-demo - h2: - console: - enabled: true - settings: - web-allow-others: true + password: test@1q2w2e4R + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://10.27.106.177:3306/jwt-demo?characterEncoding=UTF-8 + # type: com.alibaba.druid.pool.DruidDataSource +# datasource: +# driverClassName: org.h2.Driver +# username: root +# password: Talent123 +# platform: h2 +# url: jdbc:h2:mem:jwt-demo +# h2: +# console: +# enabled: true +# settings: +# web-allow-others: true jpa: hibernate: ddl-auto: update @@ -23,14 +29,16 @@ spring: enable_lazy_load_no_trans: true show-sql: true cache: - # 使用了Spring Cache后,能指定spring.cache.type就手动指定一下,虽然它会自动去适配已有Cache的依赖,但先后顺序会对Redis使用有影响(JCache -> EhCache -> Redis -> Guava) + # 使用了Spring Cache后,能指定spring.cache.type就手动指定一下, + # 它会自动去适配已有Cache的依赖,但先后顺序会对Redis使用有影响(JCache -> EhCache -> Redis -> Guava) type: REDIS redis: - host: 127.0.0.1 + host: 10.27.106.251 port: 6379 + password: Talent123 # password: 默认没有密码,生产环境一定要设置密码 # 连接超时时间(ms) - timeout: 10000 + timeout: 100 # Redis默认情况下有16个分片,这里配置具体使用的分片,默认是0 database: 0 jedis: diff --git a/src/test/java/github/javaguide/springsecurityjwtguide/BaseTest.java b/src/test/java/spring/BaseTest.java similarity index 96% rename from src/test/java/github/javaguide/springsecurityjwtguide/BaseTest.java rename to src/test/java/spring/BaseTest.java index 71f02916cdd96c14c3ee03cb8a72069662b88867..79b7648a8a827db8eba52841fba6908cb4ced9e8 100644 --- a/src/test/java/github/javaguide/springsecurityjwtguide/BaseTest.java +++ b/src/test/java/spring/BaseTest.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide; +package spring; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.BeforeEach; diff --git a/src/test/java/github/javaguide/springsecurityjwtguide/SpringSecurityJwtGuideApplicationTests.java b/src/test/java/spring/SpringSecurityJwtGuideApplicationTests.java similarity index 84% rename from src/test/java/github/javaguide/springsecurityjwtguide/SpringSecurityJwtGuideApplicationTests.java rename to src/test/java/spring/SpringSecurityJwtGuideApplicationTests.java index 6d3d07544a851815c08e7ece6582dfd463c668e7..abd83e450c2010889d89f9ce46e787017dfcbfae 100644 --- a/src/test/java/github/javaguide/springsecurityjwtguide/SpringSecurityJwtGuideApplicationTests.java +++ b/src/test/java/spring/SpringSecurityJwtGuideApplicationTests.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide; +package spring; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/src/test/java/github/javaguide/springsecurityjwtguide/security/controller/AuthControllerTest.java b/src/test/java/spring/security/controller/AuthControllerTest.java similarity index 77% rename from src/test/java/github/javaguide/springsecurityjwtguide/security/controller/AuthControllerTest.java rename to src/test/java/spring/security/controller/AuthControllerTest.java index f599b49ad8ccaf0d5019246d20d911967e21e6f0..322d9d831a3adfa778f9d08ce3b106119f013665 100644 --- a/src/test/java/github/javaguide/springsecurityjwtguide/security/controller/AuthControllerTest.java +++ b/src/test/java/spring/security/controller/AuthControllerTest.java @@ -1,7 +1,7 @@ -package github.javaguide.springsecurityjwtguide.security.controller; +package spring.security.controller; -import github.javaguide.springsecurityjwtguide.BaseTest; -import github.javaguide.springsecurityjwtguide.security.dto.LoginRequest; +import spring.BaseTest; +import spring.security.dto.LoginRequest; import org.junit.Test; import org.springframework.http.MediaType; diff --git a/src/test/java/github/javaguide/springsecurityjwtguide/system/RedisTest.java b/src/test/java/spring/system/RedisTest.java similarity index 92% rename from src/test/java/github/javaguide/springsecurityjwtguide/system/RedisTest.java rename to src/test/java/spring/system/RedisTest.java index ffddf75b01e510da75bff73d5344348a1a2803f2..73122f0a3e3d367aa0b9a906200f927f7e298c5a 100644 --- a/src/test/java/github/javaguide/springsecurityjwtguide/system/RedisTest.java +++ b/src/test/java/spring/system/RedisTest.java @@ -1,4 +1,4 @@ -package github.javaguide.springsecurityjwtguide.system; +package spring.system; import junit.framework.TestCase; import org.junit.Test; diff --git a/src/test/java/github/javaguide/springsecurityjwtguide/system/web/controller/UserControllerTest.java b/src/test/java/spring/system/web/controller/UserControllerTest.java similarity index 89% rename from src/test/java/github/javaguide/springsecurityjwtguide/system/web/controller/UserControllerTest.java rename to src/test/java/spring/system/web/controller/UserControllerTest.java index f7f322f8ae834fc2469d7cf138ff63b1a80bc8c7..a8b6148ea3b5d78cc31930817232ebacef13fffe 100644 --- a/src/test/java/github/javaguide/springsecurityjwtguide/system/web/controller/UserControllerTest.java +++ b/src/test/java/spring/system/web/controller/UserControllerTest.java @@ -1,7 +1,7 @@ -package github.javaguide.springsecurityjwtguide.system.web.controller; +package spring.system.web.controller; -import github.javaguide.springsecurityjwtguide.BaseTest; -import github.javaguide.springsecurityjwtguide.system.web.request.UserRegisterRequest; +import spring.BaseTest; +import spring.system.web.request.UserRegisterRequest; import org.junit.Test; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.result.MockMvcResultMatchers;