parent
b896a5ba3a
commit
1f82a686a2
@ -0,0 +1,3 @@
|
||||
*.js linguist-language=java
|
||||
*.css linguist-language=java
|
||||
*.html linguist-language=java
|
||||
@ -0,0 +1,4 @@
|
||||
*.iml
|
||||
target/
|
||||
.idea/
|
||||
~/
|
||||
@ -0,0 +1,31 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**
|
||||
!**/src/test/**
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2007-present the original author or authors.
|
||||
*
|
||||
* Licensed 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.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.6";
|
||||
/**
|
||||
* 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/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||
@ -0,0 +1,310 @@
|
||||
#!/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.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven 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)`"
|
||||
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
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
fi
|
||||
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 $cygwin; then
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=`cygpath --path --windows "$javaClass"`
|
||||
fi
|
||||
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
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
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 "$@"
|
||||
@ -0,0 +1,182 @@
|
||||
@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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%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%
|
||||
@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.6.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.childpassmanage</groupId>
|
||||
<artifactId>childpassmanage</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>childpassmanage</name>
|
||||
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||
<version>2.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.68</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<name>aliyun maven</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<layout>default</layout>
|
||||
<!-- 是否开启发布版构件下载 -->
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<!-- 是否开启快照版构件下载 -->
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
@ -0,0 +1,15 @@
|
||||
package com.childpassmanage.net;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import tk.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.childpassmanage.net.dao")
|
||||
public class ChildpassmanageApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ChildpassmanageApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.childpassmanage.net.controller;
|
||||
|
||||
import com.childpassmanage.net.dao.KeyPassMapper;
|
||||
import com.childpassmanage.net.pojo.KeyPassPO;
|
||||
import com.childpassmanage.net.pojo.UserNamePO;
|
||||
import com.childpassmanage.net.service.KeyPassServie;
|
||||
import com.childpassmanage.net.service.SM4PubService;
|
||||
import com.childpassmanage.net.service.UserNameService;
|
||||
import com.childpassmanage.net.utils.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class LinkUpassServerController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserNameService userNameService;
|
||||
|
||||
@Autowired
|
||||
private KeyPassMapper keyPassMapper;
|
||||
|
||||
@Autowired
|
||||
private SM4PubService sm4PubService;
|
||||
|
||||
@RequestMapping(value = "/remote/getSessionKey",method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public R getUserPublicKey(@RequestParam("username")String username,@RequestParam("password")String password) throws Exception {
|
||||
boolean userNameIfExist = userNameService.findUserNameIfExist(username);
|
||||
if (userNameIfExist) {
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
String sessionkey = Sm4Util.generateKey();
|
||||
hashMap.put("sessionkey", sessionkey);
|
||||
hashMap.put("username", username);
|
||||
HttpUtils.post("http://localhost:18088/us-admin/remote/saveUserSM4KEY", hashMap);
|
||||
return R.ok().put("sessionkey", sessionkey);
|
||||
} else {
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/remote/setUserName/{username}")
|
||||
public void setUserName(@PathVariable("username")String userName) throws Exception {
|
||||
PCIKeyPair pciKeyPair = SM2Util.genKeyPair();
|
||||
String priKey = pciKeyPair.getPriKey();
|
||||
String pubKey = pciKeyPair.getPubKey();
|
||||
sm4PubService.insertPubKey(pubKey,userName);
|
||||
UserNamePO userNamePO = new UserNamePO();
|
||||
userNamePO.setUserName(userName);
|
||||
userNamePO.setCreateDate(new Date());
|
||||
userNamePO.setIfClose(0);
|
||||
userNamePO.setPriKey(priKey);
|
||||
userNameService.insertUserName(userNamePO);
|
||||
}
|
||||
|
||||
@RequestMapping("/remote/getSM2Pub/{username}")
|
||||
@ResponseBody
|
||||
public R getSM4Pub(@PathVariable("username")String username){
|
||||
String pubKey =sm4PubService.getSM4PubByUserName(username);
|
||||
return R.ok().put("pubKey", pubKey);
|
||||
}
|
||||
|
||||
@RequestMapping("/remote/getSM2Pri/{username}")
|
||||
@ResponseBody
|
||||
public R getSM4Pri(@PathVariable("username")String username){
|
||||
String pubKey =userNameService.getSM4PriByUserName(username);
|
||||
return R.ok().put("priKey", pubKey);
|
||||
}
|
||||
|
||||
@RequestMapping("/remote/savekeypass/{username}")
|
||||
@ResponseBody
|
||||
public R saveKeyPass(@PathVariable("username")String username,@RequestParam("keyPass")String keyPass){
|
||||
KeyPassPO keyPassPO = new KeyPassPO();
|
||||
Map<String, Long> split = Shamir.split(Integer.parseInt(keyPass));
|
||||
keyPassPO.setDian0(split.get("dian[0]"));
|
||||
keyPassPO.setDian1(split.get("dian[1]"));
|
||||
keyPassPO.setDian2(split.get("dian[2]"));
|
||||
keyPassPO.setF0(split.get("f[0]"));
|
||||
keyPassPO.setF1(split.get("f[1]"));
|
||||
keyPassPO.setF2(split.get("f[2]"));
|
||||
keyPassPO.setP(split.get("p"));
|
||||
keyPassPO.setUsername(username);
|
||||
keyPassMapper.insert(keyPassPO);
|
||||
return R.ok().put("flag", "true");
|
||||
}
|
||||
|
||||
@RequestMapping("/remote/getKeyPass/{username}")
|
||||
@ResponseBody
|
||||
public R getKeyPass(@PathVariable("username")String username){
|
||||
KeyPassPO keyPassPO = new KeyPassPO();
|
||||
keyPassPO.setUsername(username);
|
||||
List<KeyPassPO> select = keyPassMapper.select(keyPassPO);
|
||||
KeyPassPO keyPassPO1 = select.get(0);
|
||||
Map<String ,Long> hashMap = new HashMap<>();
|
||||
hashMap.put("dian[0]", keyPassPO1.getDian0());
|
||||
hashMap.put("dian[1]", keyPassPO1.getDian1());
|
||||
hashMap.put("dian[2]", keyPassPO1.getDian2());
|
||||
hashMap.put("f[0]", keyPassPO1.getF0());
|
||||
hashMap.put("f[1]", keyPassPO1.getF1());
|
||||
hashMap.put("f[2]", keyPassPO1.getF2());
|
||||
hashMap.put("p", keyPassPO1.getP());
|
||||
long combine = Shamir.combine(hashMap);
|
||||
String keyByPass = ThroughUserkey.getKeyByPass(combine+"");
|
||||
return R.ok().put("keyPass",keyByPass);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.childpassmanage.net.controller;
|
||||
|
||||
import com.childpassmanage.net.dao.KeyPassMapper;
|
||||
import com.childpassmanage.net.pojo.KeyPassPO;
|
||||
import com.childpassmanage.net.service.RandomService;
|
||||
import com.childpassmanage.net.utils.*;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class RandomStringController {
|
||||
|
||||
@Autowired
|
||||
private RandomService randomService;
|
||||
|
||||
@Autowired
|
||||
private KeyPassMapper keyPassMapper;
|
||||
|
||||
@RequestMapping(value = "remote/ranstr/{userName}/{keyId}",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public R getRandomString(@PathVariable("userName") String userName,@PathVariable("keyId")String keyId) throws Exception {
|
||||
String sm4Key = Sm4Util.generateKey();
|
||||
R r = new R();
|
||||
r.put("random", sm4Key);
|
||||
KeyPassPO keyPassPO = new KeyPassPO();
|
||||
keyPassPO.setUsername(userName);
|
||||
List<KeyPassPO> select = keyPassMapper.select(keyPassPO);
|
||||
KeyPassPO keyPassPO1 = select.get(0);
|
||||
Map<String ,Long> hashMap = new HashMap<>();
|
||||
hashMap.put("dian[0]", keyPassPO1.getDian0());
|
||||
hashMap.put("dian[1]", keyPassPO1.getDian1());
|
||||
hashMap.put("dian[2]", keyPassPO1.getDian2());
|
||||
hashMap.put("f[0]", keyPassPO1.getF0());
|
||||
hashMap.put("f[1]", keyPassPO1.getF1());
|
||||
hashMap.put("f[2]", keyPassPO1.getF2());
|
||||
hashMap.put("p", keyPassPO1.getP());
|
||||
long combine = Shamir.combine(hashMap);
|
||||
String keyByPass = ThroughUserkey.getKeyByPass(combine+"");
|
||||
byte[] encryptSM4key = AESUtil.encrypt(sm4Key, keyByPass);
|
||||
Boolean flag = randomService.insertRandomStringByUserName(userName,new String(encryptSM4key),keyId);
|
||||
return flag ? r:R.error();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "remote/ranstr/{keyId}",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public R getKeyRanByKeyId(@PathVariable("keyId")String keyId){
|
||||
String ranStr = randomService.getRandomStringByKeyId(keyId);
|
||||
return R.ok().put("ranstr",ranStr);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.childpassmanage.net.dao;
|
||||
|
||||
import com.childpassmanage.net.pojo.KeyPairPO;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
@Component
|
||||
public interface KeyPairMapper extends Mapper<KeyPairPO> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.childpassmanage.net.dao;
|
||||
|
||||
import com.childpassmanage.net.pojo.KeyPassPO;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
@Component
|
||||
public interface KeyPassMapper extends Mapper<KeyPassPO> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.childpassmanage.net.dao;
|
||||
|
||||
import com.childpassmanage.net.pojo.RandomStringPO;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
@Component
|
||||
public interface RandomMapper extends Mapper<RandomStringPO> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.childpassmanage.net.dao;
|
||||
|
||||
import com.childpassmanage.net.pojo.SM4PubPO;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
@Component
|
||||
public interface SM4PubMapper extends Mapper<SM4PubPO> {
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.childpassmanage.net.dao;
|
||||
|
||||
|
||||
import com.childpassmanage.net.pojo.UserNamePO;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
@Component
|
||||
public interface UserNameMapper extends Mapper<UserNamePO> {
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.childpassmanage.net.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class AdminUser {
|
||||
private Integer id;
|
||||
private String username;
|
||||
private String password;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.childpassmanage.net.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class KeyPairPO {
|
||||
private Integer id;
|
||||
private String userName;
|
||||
private String pubKey;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.childpassmanage.net.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Table(name = "p_passdata")
|
||||
public class KeyPassPO {
|
||||
private Integer id;
|
||||
private String username;
|
||||
private Long dian0;
|
||||
private Long dian1;
|
||||
private Long dian2;
|
||||
private Long f0;
|
||||
private Long f1;
|
||||
private Long f2;
|
||||
private Long p;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.childpassmanage.net.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Table(name = "p_random")
|
||||
public class RandomStringPO {
|
||||
private Integer id;
|
||||
private String userName;
|
||||
private String randomStr;
|
||||
private Integer keyId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.childpassmanage.net.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Table(name = "p_sm4pub")
|
||||
public class SM4PubPO {
|
||||
private Integer id;
|
||||
private String pubkey;
|
||||
private String username;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.childpassmanage.net.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Table(name = "p_username")
|
||||
public class UserNamePO {
|
||||
private Integer id;
|
||||
private String userName;
|
||||
private Date createDate;
|
||||
private Integer ifClose;
|
||||
private String priKey;
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.childpassmanage.net.service;
|
||||
|
||||
import com.childpassmanage.net.pojo.KeyPairPO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
public interface KeyPairService {
|
||||
|
||||
Integer insertKeyPairByUsername(String username, String priKey);
|
||||
|
||||
KeyPairPO selectKeyPairByUserName(String username);
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.childpassmanage.net.service;
|
||||
|
||||
public interface KeyPassServie {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.childpassmanage.net.service;
|
||||
|
||||
public interface RandomService {
|
||||
public Boolean insertRandomStringByUserName(String userName ,String randomKey,String keyId);
|
||||
public Boolean updateRandomStringByUserNameAndKey(String userName, Integer keyId,String randomStr);
|
||||
public String getRandomStringByKeyId(String keyId);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.childpassmanage.net.service;
|
||||
|
||||
public interface SM4PubService {
|
||||
String getSM4PubByUserName(String username);
|
||||
|
||||
void insertPubKey(String pubKey, String userName);
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.childpassmanage.net.service;
|
||||
|
||||
import com.childpassmanage.net.pojo.UserNamePO;
|
||||
|
||||
public interface UserNameService {
|
||||
/**
|
||||
* 查找用户名是否存在
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
boolean findUserNameIfExist(String username);
|
||||
|
||||
/**
|
||||
* 插入新用户名
|
||||
* @param userNamePO
|
||||
*/
|
||||
void insertUserName(UserNamePO userNamePO);
|
||||
|
||||
String getSM4PriByUserName(String username);
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.childpassmanage.net.service.impl;
|
||||
|
||||
import com.childpassmanage.net.dao.KeyPairMapper;
|
||||
import com.childpassmanage.net.pojo.KeyPairPO;
|
||||
import com.childpassmanage.net.service.KeyPairService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class KeyPairServiceImpl implements KeyPairService {
|
||||
|
||||
@Autowired
|
||||
private KeyPairMapper keyPairMapper;
|
||||
|
||||
@Override
|
||||
public Integer insertKeyPairByUsername(String username, String priKey) {
|
||||
KeyPairPO keyPairPO = new KeyPairPO();
|
||||
keyPairPO.setUserName(username);
|
||||
keyPairPO.setPubKey(priKey);
|
||||
int count = keyPairMapper.insert(keyPairPO);
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyPairPO selectKeyPairByUserName(String username) {
|
||||
KeyPairPO keyPairPO = new KeyPairPO();
|
||||
keyPairPO.setUserName(username);
|
||||
KeyPairPO keyPairPOS = keyPairMapper.selectOne(keyPairPO);
|
||||
return keyPairPOS;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.childpassmanage.net.service.impl;
|
||||
|
||||
import com.childpassmanage.net.service.KeyPassServie;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class KeyPassServiceImpl implements KeyPassServie {
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.childpassmanage.net.service.impl;
|
||||
|
||||
import com.childpassmanage.net.dao.RandomMapper;
|
||||
import com.childpassmanage.net.pojo.RandomStringPO;
|
||||
import com.childpassmanage.net.service.RandomService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class RandomServiceImpl implements RandomService {
|
||||
|
||||
@Autowired
|
||||
private RandomMapper randomMapper;
|
||||
|
||||
@Override
|
||||
public Boolean insertRandomStringByUserName(String userName, String randomKey,String keyId) {
|
||||
RandomStringPO randomStringPO = new RandomStringPO();
|
||||
randomStringPO.setRandomStr(randomKey);
|
||||
randomStringPO.setUserName(userName);
|
||||
randomStringPO.setKeyId(Integer.parseInt(keyId));
|
||||
int insert = randomMapper.insert(randomStringPO);
|
||||
return insert == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateRandomStringByUserNameAndKey(String userName, Integer keyId,String randomStr) {
|
||||
RandomStringPO randomStringPO = new RandomStringPO();
|
||||
randomStringPO.setUserName(userName);
|
||||
randomStringPO.setRandomStr(randomStr);
|
||||
RandomStringPO randomStringPO1 = randomMapper.selectOne(randomStringPO);
|
||||
if(randomStringPO1!=null){
|
||||
randomStringPO.setKeyId(keyId);
|
||||
}
|
||||
int update = randomMapper.updateByPrimaryKey(randomStringPO1);
|
||||
return update == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRandomStringByKeyId(String keyId) {
|
||||
RandomStringPO randomStringPO = new RandomStringPO();
|
||||
randomStringPO.setKeyId(Integer.parseInt(keyId));
|
||||
RandomStringPO randomString = randomMapper.selectOne(randomStringPO);
|
||||
return randomString.getRandomStr();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.childpassmanage.net.service.impl;
|
||||
|
||||
import com.childpassmanage.net.dao.SM4PubMapper;
|
||||
import com.childpassmanage.net.dao.UserNameMapper;
|
||||
import com.childpassmanage.net.pojo.SM4PubPO;
|
||||
import com.childpassmanage.net.pojo.UserNamePO;
|
||||
import com.childpassmanage.net.service.SM4PubService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SM4PubServiceImpl implements SM4PubService {
|
||||
|
||||
@Autowired
|
||||
private SM4PubMapper sm4PubMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public String getSM4PubByUserName(String username) {
|
||||
SM4PubPO sm4PubPO = new SM4PubPO();
|
||||
sm4PubPO.setUsername(username);
|
||||
List<SM4PubPO> select = sm4PubMapper.select(sm4PubPO);
|
||||
return select.get(0).getPubkey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertPubKey(String pubKey, String userName) {
|
||||
SM4PubPO sm4PubPO = new SM4PubPO();
|
||||
sm4PubPO.setUsername(userName);
|
||||
sm4PubPO.setPubkey(pubKey);
|
||||
sm4PubMapper.insert(sm4PubPO);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.childpassmanage.net.service.impl;
|
||||
|
||||
import com.childpassmanage.net.dao.UserNameMapper;
|
||||
import com.childpassmanage.net.pojo.UserNamePO;
|
||||
import com.childpassmanage.net.service.UserNameService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class UserNameServiceImpl implements UserNameService {
|
||||
@Autowired
|
||||
private UserNameMapper userMapper;
|
||||
|
||||
@Override
|
||||
public boolean findUserNameIfExist(String username) {
|
||||
UserNamePO userNamePO = new UserNamePO();
|
||||
userNamePO.setUserName(username);
|
||||
UserNamePO userNamePO1 = userMapper.selectOne(userNamePO);
|
||||
if(userNamePO1 != null || userNamePO1.getIfClose() != -1){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUserName(UserNamePO userNamePO) {
|
||||
userMapper.insert(userNamePO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSM4PriByUserName(String username) {
|
||||
UserNamePO userNamePO = new UserNamePO();
|
||||
userNamePO.setUserName(username);
|
||||
List<UserNamePO> select = userMapper.select(userNamePO);
|
||||
return select.get(0).getPriKey();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,417 @@
|
||||
package com.childpassmanage.net.utils;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName: CommonUtils
|
||||
* @Description: 通用工具类
|
||||
* @since: 0.0.1
|
||||
* @author: dzy
|
||||
* @date: 2017年2月22日 上午11:46:44
|
||||
*/
|
||||
public class CommonUtils {
|
||||
|
||||
|
||||
/**
|
||||
* @param date 日期
|
||||
* @param pattern 模式 如:yyyyMMdd等
|
||||
* @return
|
||||
* @Title: formatDate
|
||||
* @Description: 格式化日期
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String formatDate(Date date, String pattern) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(pattern);
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param strDate String类型日期
|
||||
* @param pattern 日期显示模式
|
||||
* @return
|
||||
* @Title: parseDate
|
||||
* @Description: 将String日期转换为Date类型日期
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static Date parseDate(String strDate, String pattern) {
|
||||
SimpleDateFormat formatter = null;
|
||||
if (StringUtils.isEmpty(strDate) || strDate.equals("")) {
|
||||
return null;
|
||||
}
|
||||
formatter = new SimpleDateFormat(pattern);
|
||||
try {
|
||||
return formatter.parse(strDate);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date 操作前的日期
|
||||
* @param field 日期的部分如:年,月,日
|
||||
* @param amount 增加或减少的值(负数表示减少)
|
||||
* @return
|
||||
* @Title: dateAdd
|
||||
* @Description: 日期的加减操作
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static Date dateAdd(Date date, int field, int amount) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(field, amount);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param source 源字符串
|
||||
* @param offset 填充开始的位置, 0-在左边, source.getBytes().length 在右边, 如果有中文时需小心位置
|
||||
* @param c 用于填充的字符
|
||||
* @param length 最后字符串的字节长度
|
||||
* @return
|
||||
* @Title: fill
|
||||
* @Description: 填充字符串, 长度是按字节计算, 不是字符
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String fill(String source, int offset, char c, int length) throws UnsupportedEncodingException {
|
||||
if (null == source) {
|
||||
source = "";
|
||||
}
|
||||
if (source.getBytes("utf-8").length == length) {
|
||||
return source;
|
||||
}
|
||||
byte[] buf = new byte[length];
|
||||
byte[] src = source.getBytes("utf-8");
|
||||
if (src.length > length) {
|
||||
System.arraycopy(src, src.length - length, buf, 0, length);
|
||||
return new String(buf, "utf-8");
|
||||
}
|
||||
if (offset > src.length) {
|
||||
offset = src.length;
|
||||
} else if (offset < 0) {
|
||||
offset = 0;
|
||||
}
|
||||
int n = length - src.length;
|
||||
|
||||
System.arraycopy(src, 0, buf, 0, offset);
|
||||
for (int i = 0; i < n; i++) {
|
||||
buf[i + offset] = (byte) c;
|
||||
}
|
||||
System.arraycopy(src, offset, buf, offset + n, src.length - offset);
|
||||
return new String(buf, "utf-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param original 原字符串
|
||||
* @param offset 填充开始的位置, 0-在左边, original.getBytes().length 在右边, 如果有中文时需小心位置
|
||||
* @param length 替换的字节数
|
||||
* @param c 用于替换的字符
|
||||
* @return
|
||||
* @Title: replace
|
||||
* @Description: 替换字符串, 长度是按字节计算, 不是字符
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String replace(String original, int offset, int length, char c) throws UnsupportedEncodingException {
|
||||
if (original == null) {
|
||||
original = "";
|
||||
}
|
||||
if (original.getBytes("utf-8").length <= offset) {
|
||||
return original;
|
||||
}
|
||||
if (original.getBytes("utf-8").length < offset + length) {
|
||||
length = original.getBytes("utf-8").length - offset;
|
||||
}
|
||||
byte[] buf = new byte[original.length()];
|
||||
byte[] src = original.getBytes("utf-8");
|
||||
System.arraycopy(src, 0, buf, 0, offset);
|
||||
|
||||
for (int i = offset; i < offset + length; i++) {
|
||||
buf[i] = (byte) c;
|
||||
}
|
||||
System.arraycopy(src, offset + length, buf, offset + length, src.length - offset - length);
|
||||
return new String(buf, "utf-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param s 16进制字符串
|
||||
* @return
|
||||
* @Title: hexToByte
|
||||
* @Description: 16进制字符串转字节数组
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static byte[] hexToByte(String s) {
|
||||
byte[] result = null;
|
||||
try {
|
||||
int i = s.length();
|
||||
// if (i % 2 == 1) {
|
||||
// throw new Exception("字符串长度不是偶数.");
|
||||
// }
|
||||
if (i % 2 != 0) {
|
||||
throw new Exception("字符串长度不是偶数.");
|
||||
}
|
||||
result = new byte[i / 2];
|
||||
for (int j = 0; j < result.length; j++) {
|
||||
result[j] = (byte) Integer.parseInt(s.substring(j * 2, j * 2 + 2), 16);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result = null;
|
||||
e.printStackTrace();
|
||||
// log.error("16进制字符串转字节数组时出现异常:", e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bytes 字节数组
|
||||
* @return
|
||||
* @Title: byte2hexString
|
||||
* @Description: 字节数组转换为16进制字符串 //0x33 0xD2 0x00 0x46 转换为 "33d20046" 转换和打印报文用
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String byte2hexString(byte[] bytes) {
|
||||
StringBuffer buf = new StringBuffer(bytes.length * 2);
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
if (((int) bytes[i] & 0xff) < 0x10) {
|
||||
buf.append("0");
|
||||
}
|
||||
buf.append(Long.toString((int) bytes[i] & 0xff, 16));
|
||||
}
|
||||
return buf.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hexString 16进制字符串 如:"33d20046" 转换为 0x33 0xD2 0x00 0x46
|
||||
* @return
|
||||
* @Title: hexString2byte
|
||||
* @Description: 16进制字符串转字节数组
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static byte[] hexString2byte(String hexString) {
|
||||
if (null == hexString || hexString.length() % 2 != 0 || hexString.contains("null")) {
|
||||
return null;
|
||||
}
|
||||
byte[] bytes = new byte[hexString.length() / 2];
|
||||
for (int i = 0; i < hexString.length(); i += 2) {
|
||||
bytes[i / 2] = (byte) (Integer.parseInt(hexString.substring(i, i + 2), 16) & 0xff);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i 需要转的int类型数字
|
||||
* @return
|
||||
* @Title: byte1ToBcd2
|
||||
* @Description: int类型转BCD码
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String byte1ToBcd2(int i) {
|
||||
// return (new Integer(i / 16).toString() + (new Integer(i % 16)).toString());
|
||||
return Integer.toString(i / 16) + Integer.toString(i % 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b 字节数组
|
||||
* @return
|
||||
* @Title: byteToHex2
|
||||
* @Description: 字节数组转换为16进制字符串 For example, byte[] {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF} will be changed to String "0123456789ABCDEF"
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String byteToHex2(byte[] b) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
String tmp = "";
|
||||
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
tmp = Integer.toHexString(b[i] & 0xff);
|
||||
if (tmp.length() == 1) {
|
||||
result.append("0" + tmp);
|
||||
} else {
|
||||
result.append(tmp);
|
||||
}
|
||||
}
|
||||
return result.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param num 数字
|
||||
* @param len 字节数组长度
|
||||
* @return
|
||||
* @Title: intToHexBytes
|
||||
* @Description: int类型转16进制字节数组
|
||||
*/
|
||||
public static byte[] intToHexBytes(int num, int len) {
|
||||
byte[] bytes = null;
|
||||
String hexString = Integer.toHexString(num);
|
||||
if (len > 0) {
|
||||
int length = len * 2;
|
||||
hexString = leftFill(hexString, '0', length);
|
||||
bytes = CommonUtils.hexString2byte(hexString);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private static String leftFill(String hexString, char c, int length) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if(hexString.length() < length){
|
||||
for(int count = 0; count <length-hexString.length();count++){
|
||||
stringBuilder.append(c);
|
||||
}
|
||||
}
|
||||
return stringBuilder.append(hexString).toString();
|
||||
}
|
||||
|
||||
/*public static String byteToHex3(byte[] b) {
|
||||
String result = "";
|
||||
String tmp = "";
|
||||
|
||||
for (int n = 0; n < b.length; n++) {
|
||||
tmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
|
||||
if (tmp.length() == 1) {
|
||||
result = result + "0" + tmp;
|
||||
} else {
|
||||
result = result + tmp;
|
||||
}
|
||||
if (n < b.length - 1) {
|
||||
result = result + "";
|
||||
}
|
||||
}
|
||||
return result.toUpperCase();
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @param str 需要转换编码的字符串
|
||||
* @return
|
||||
* @Title: iso2Gbk
|
||||
* @Description: 将ISO-8859-1编码的字符串转成GBK编码的字符串
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String iso2Gbk(String str) {
|
||||
if (null == str) {
|
||||
return str;
|
||||
}
|
||||
try {
|
||||
return new String(str.getBytes("ISO-8859-1"), "GBK");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// log.error("不支持的编码异常:", e);
|
||||
e.printStackTrace();
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @param message
|
||||
// * @return
|
||||
// * @Title: getSubElement
|
||||
// * @Description: 分解各子域到HashMap
|
||||
// * @since: 0.0.1
|
||||
// */
|
||||
// public static Map<String, String> getSubElement(byte[] message) {
|
||||
// Map<String, String> map = new HashMap<String, String>();
|
||||
// String key = null;
|
||||
// String value = null;
|
||||
// int len = 0;
|
||||
// int idx = 0;
|
||||
// while (idx < message.length) {
|
||||
// key = new String(message, idx, 2);
|
||||
// idx += 2; //取了SE id 移2位
|
||||
// len = Integer.parseInt(new String(message, idx, 2));
|
||||
// idx += 2; //取了SE id的内容长度 移2位
|
||||
// value = new String(message, idx, len);
|
||||
// map.put(key, value);
|
||||
// idx += len;
|
||||
// }
|
||||
// return map;
|
||||
// }
|
||||
|
||||
//byte数组转成long
|
||||
|
||||
/**
|
||||
* @param b 将字节数组转long类型 位置为小端
|
||||
* @return
|
||||
*/
|
||||
public static long byteToLong(byte[] b) {
|
||||
long s = 0;
|
||||
long s0 = b[0] & 0xff;// 最低位
|
||||
long s1 = b[1] & 0xff;
|
||||
long s2 = b[2] & 0xff;
|
||||
long s3 = b[3] & 0xff;
|
||||
long s4 = b[4] & 0xff;// 最低位
|
||||
long s5 = b[5] & 0xff;
|
||||
long s6 = b[6] & 0xff;
|
||||
long s7 = b[7] & 0xff;
|
||||
|
||||
// s0不变
|
||||
s1 <<= 8;
|
||||
s2 <<= 16;
|
||||
s3 <<= 24;
|
||||
s4 <<= 8 * 4;
|
||||
s5 <<= 8 * 5;
|
||||
s6 <<= 8 * 6;
|
||||
s7 <<= 8 * 7;
|
||||
s = s0 | s1 | s2 | s3 | s4 | s5 | s6 | s7;
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b 将字节数组转int类型 位置为小端
|
||||
* @return
|
||||
*/
|
||||
public static int byteToInt(byte[] b) {
|
||||
int s = 0;
|
||||
int s0 = b[0] & 0xff;// 最低位
|
||||
int s1 = b[1] & 0xff;
|
||||
int s2 = b[2] & 0xff;
|
||||
int s3 = b[3] & 0xff;
|
||||
|
||||
// s0不变
|
||||
s1 <<= 8;
|
||||
s2 <<= 16;
|
||||
s3 <<= 24;
|
||||
|
||||
s = s0 | s1 | s2 | s3;
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* int类型转换小端的byte数组
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public static byte[] intToLittleBytes(int i) {
|
||||
ByteBuffer byteBuffer = ByteBuffer.allocate(4);
|
||||
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
byteBuffer.asIntBuffer().put(i);
|
||||
byte[] littleBytes = byteBuffer.array();
|
||||
return littleBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将一个字节转成10进制
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
public static int byteToInt(byte b) {
|
||||
int value = b & 0xff;
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节数组合并
|
||||
* @param bt1 字节数组bt1
|
||||
* @param bt2 字节数组bt2
|
||||
* @return
|
||||
*/
|
||||
public static byte[] byteMerger(byte[] bt1, byte[] bt2){
|
||||
byte[] bt3 = new byte[bt1.length+bt2.length];
|
||||
System.arraycopy(bt1, 0, bt3, 0, bt1.length);
|
||||
System.arraycopy(bt2, 0, bt3, bt1.length, bt2.length);
|
||||
return bt3;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.childpassmanage.net.utils;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PCIKeyPair {
|
||||
|
||||
private String priKey; //私钥
|
||||
private String pubKey; //公钥
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.childpassmanage.net.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class R extends HashMap<String, Object> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public R() {
|
||||
put("code", 200);
|
||||
}
|
||||
|
||||
public static R error() {
|
||||
return error(500, "未知异常,请联系管理员");
|
||||
}
|
||||
|
||||
public static R error(String msg) {
|
||||
return error(500, msg);
|
||||
}
|
||||
|
||||
public static R error(int code, String msg) {
|
||||
R r = new R();
|
||||
r.put("code", code);
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(String msg) {
|
||||
R r = new R();
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(Map<String, Object> map) {
|
||||
R r = new R();
|
||||
r.putAll(map);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok() {
|
||||
return new R();
|
||||
}
|
||||
|
||||
public R put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
|
||||
<configuration scan="true" scanPeriod="3 seconds">
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>~/data/us-servicelog.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>~/data/us-%d{yyyyMMdd}.log.%i</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>500MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<maxHistory>100</maxHistory>
|
||||
</rollingPolicy>
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n
|
||||
</Pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
<!--additivity 是否向上传递 true就会打印多次 false只打印1次 INFO改成DEBUG可打印sql日志-->
|
||||
<logger name="com.passManage" level="DEBUG" additivity="false">
|
||||
<!--也可以选择其他的ref 来增加新的日志文件-->
|
||||
<appender-ref ref="INFO_FILE" />
|
||||
<!--控制台是否打印-->
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</logger>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="INFO_FILE" />
|
||||
</root>
|
||||
</configuration>
|
||||
@ -0,0 +1,13 @@
|
||||
package com.childpassmanage.net;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class ChildpassmanageApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
{"passId":123555,"passType":"SM2","passChildfir":"044783f57ab77198c74a4a8ec2db7c8e64db2164f28feb1910bf2aa0dcd6c344ef23408f526412911e692a880e35deb04768c78b31bf1e9942964ec2f157c71490ec2dd950ed11e8c2e3e6df0b413443d36eef8a522bca930bb055682582b4a6e5a95337890d1107cab6cd10112368a1d0a5c595ce55b68ceb717ce0c195da9de8048a5632cc380f7848a5432c5e1bffb43ddd12dfbd55784c74e74714b50b2dd82520","passChildsec":"046a273ba00d097067d157a282da4c3f849f30248fc7a45737bc7e10c9f22cf60a4ee159c8173a0d3834d08ac4fa3dd1bb20eea3bf87414786bae02f35888c5b4939aab20f259d332e882251a422212a5ee0df2db118e73f2bec07dd236fd3a0a2313e58729da893475567e13ddc5a5c64fa577e3e3caf8fc3d30ec01e6594f628bbdc6a2520cb8f6b10609b990c44c7fd6f3f7de2a4258d455b9fecc758f374a2af04","username":"yg9531"}
|
||||
@ -0,0 +1,31 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**
|
||||
!**/src/test/**
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2007-present the original author or authors.
|
||||
*
|
||||
* Licensed 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.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.6";
|
||||
/**
|
||||
* 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/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".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 directory '" + 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 {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||
@ -0,0 +1,310 @@
|
||||
#!/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.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven 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)`"
|
||||
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
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
fi
|
||||
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 $cygwin; then
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=`cygpath --path --windows "$javaClass"`
|
||||
fi
|
||||
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
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
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 "$@"
|
||||
@ -0,0 +1,182 @@
|
||||
@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 Maven 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 keystroke 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 by 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.5.6/maven-wrapper-0.5.6.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% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%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%
|
||||
@ -0,0 +1,20 @@
|
||||
package com.passuser.net.KeyUtils;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PCIKeyPair {
|
||||
|
||||
private String priKey; //私钥
|
||||
private String pubKey; //公钥
|
||||
private String username; //用户名
|
||||
|
||||
public PCIKeyPair(String priKey, String pubKey) {
|
||||
this.priKey = priKey;
|
||||
this.pubKey = pubKey;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.passuser.net;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class PassuserApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PassuserApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.passuser.net.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author Think
|
||||
* @Title: AuthToken
|
||||
* @ProjectName token-authentication
|
||||
* @Description: TODO
|
||||
* @date 2019/1/1815:52
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface AuthToken {
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.passuser.net.configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.passuser.net.interceptor.AuthorizationInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* @author cailei.lu
|
||||
* @description
|
||||
* @date 2018/8/3
|
||||
*/
|
||||
@Configuration
|
||||
public class WebAppConfiguration implements WebMvcConfigurer {
|
||||
@Bean
|
||||
public AuthorizationInterceptor getAuthorizationInterceptor(){
|
||||
return new AuthorizationInterceptor();
|
||||
}
|
||||
/**
|
||||
* redisTemplate 序列化使用的jdkSerializeable, 存储二进制字节码, 所以自定义序列化类
|
||||
* @param redisConnectionFactory
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
|
||||
// 使用Jackson2JsonRedisSerialize 替换默认序列化
|
||||
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||
|
||||
jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
|
||||
|
||||
// 设置value的序列化规则和 key的序列化规则
|
||||
redisTemplate.setValueSerializer(new StringRedisSerializer());
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(getAuthorizationInterceptor()).addPathPatterns("/**");
|
||||
}
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
//将所有/static/** 访问都映射到classpath:/static/ 目录下
|
||||
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,461 @@
|
||||
package com.passuser.net.controller.key;
|
||||
|
||||
import ch.qos.logback.core.encoder.ByteArrayUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.passuser.net.KeyUtils.*;
|
||||
import com.passuser.net.annotation.AuthToken;
|
||||
import com.passuser.net.entity.PpassInstant;
|
||||
import com.passuser.net.utils.*;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang.time.DateFormatUtils;
|
||||
import org.apache.http.cookie.SM;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/passInstant")
|
||||
public class KeyController {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private ResolveResponUtils resolveResponUtils;
|
||||
|
||||
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
private String PREFIX = "/PassInstant/passInstant/";
|
||||
|
||||
/**
|
||||
* 跳转到密钥管理首页
|
||||
*/
|
||||
@RequestMapping("")
|
||||
public String index() {
|
||||
return PREFIX + "passInstant.html";
|
||||
}
|
||||
|
||||
@RequestMapping("passInstant_upload")
|
||||
public String uploadPpass(){return PREFIX + "passInstant_upload.html";}
|
||||
|
||||
/**
|
||||
* 跳转到添加密钥管理
|
||||
*/
|
||||
@RequestMapping("/passInstant_add")
|
||||
public String passInstantAdd() {
|
||||
return PREFIX + "passInstant_add.html";
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
@AuthToken
|
||||
@ResponseBody
|
||||
public String getKeyList(HttpServletRequest request) throws Exception {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String username = redisTemplate.opsForValue().get(token);
|
||||
List<String> strList = new ArrayList<>();
|
||||
strList.add("encryptData");
|
||||
Map<String, String> encryptData = resolveResponUtils.getGetResponseDecryptData("http://localhost:18088/us-admin/remote/getKeyList/" + username, null, strList);
|
||||
Gson gson = new Gson();
|
||||
List<PpassInstant> nowPassInstant = gson.fromJson(encryptData.get("encryptData"), new TypeToken<List<PpassInstant>>() {
|
||||
}.getType());
|
||||
Map<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("code", "0");
|
||||
hashMap.put("data", nowPassInstant);
|
||||
String postJSON = gson.toJson(hashMap);
|
||||
return postJSON;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
@AuthToken
|
||||
public String generateKeyAndUpload(PpassInstant ppassInstant, HttpServletRequest request) throws Exception {
|
||||
String passType = ppassInstant.getPassType();
|
||||
ppassInstant.setPassCreatetime(DateFormatUtils.format(new Date(), "yyyy-MM-dd hh:mm:ss"));
|
||||
return addNewKeyByData(ppassInstant, request, passType);
|
||||
|
||||
}
|
||||
|
||||
private String addNewKeyByData(PpassInstant ppassInstant, HttpServletRequest request, String passType) throws Exception {
|
||||
switch (passType) {
|
||||
case "SM4":
|
||||
Map<String, String> SM4flag = generateSM4Key(ppassInstant, request);
|
||||
SM4flag.put("keyId", ppassInstant.getPassId() + "");
|
||||
return SM4flag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
case "SM2":
|
||||
Map<String, String> SM2flag = generateSM2key(ppassInstant, request);
|
||||
SM2flag.put("keyId", ppassInstant.getPassId() + "");
|
||||
return SM2flag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
case ("AES"):
|
||||
Map<String, String> AESflag = generateAESKey(ppassInstant, request);
|
||||
AESflag.put("keyId", ppassInstant.getPassId() + "");
|
||||
return AESflag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
case ("DES"):
|
||||
Map<String, String> DESflag = generateDESKey(ppassInstant, request);
|
||||
DESflag.put("keyId", ppassInstant.getPassId() + "");
|
||||
return DESflag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
case ("RSA"):
|
||||
Map<String, String> RSAflag = generateRSAkey(ppassInstant, request);
|
||||
RSAflag.put("keyId", ppassInstant.getPassId() + "");
|
||||
return RSAflag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
default:
|
||||
return "404.html";
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> generateSM2key(PpassInstant ppassInstant, HttpServletRequest request) throws Exception {
|
||||
Map<String, String> sm2key = getSM2KeyPairToJSON();
|
||||
return resolveSetPpassInstant(ppassInstant, request, sm2key);
|
||||
}
|
||||
|
||||
private Map<String, String> generateSM4Key(PpassInstant ppassInstant, HttpServletRequest request) throws Exception {
|
||||
String sm4key = Sm4Util.generateKey();
|
||||
return resolveSetPpassInstant(ppassInstant, request, sm4key);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("updateKey/{keyId}")
|
||||
@AuthToken
|
||||
public String updateKeyAndUpload(@PathVariable("keyId") String keyId, @ModelAttribute PpassInstant ppassInstant, Model model, HttpServletRequest request) throws Exception {
|
||||
return UpdateKeyAndUpload(keyId, ppassInstant, request);
|
||||
}
|
||||
|
||||
private String UpdateKeyAndUpload(@PathVariable("keyId") String keyId, @ModelAttribute PpassInstant ppassInstant, HttpServletRequest request) throws Exception {
|
||||
String passType = ppassInstant.getPassType();
|
||||
switch (passType) {
|
||||
case ("SM4"):
|
||||
String sm4key = Sm4Util.generateKey();
|
||||
Map<String, String> SM4flag = resolveSetPpassInstantById(keyId, ppassInstant, request, sm4key);
|
||||
return SM4flag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
case ("SM2"):
|
||||
Map<String, String> sm2key = getSM2KeyPairToJSON();
|
||||
Map<String, String> SM2flag = resolveSetSM2PpassInstantById(keyId, ppassInstant, request, sm2key);
|
||||
return SM2flag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
case ("AES"):
|
||||
Map<String, String> AESflag = generateAESKey(ppassInstant, request);
|
||||
AESflag.put("keyId", ppassInstant.getPassId() + "");
|
||||
return AESflag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
case ("DES"):
|
||||
Map<String, String> DESflag = generateDESKey(ppassInstant, request);
|
||||
DESflag.put("keyId", ppassInstant.getPassId() + "");
|
||||
return DESflag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
case ("RSA"):
|
||||
Map<String, String> RSAflag = generateRSAkey(ppassInstant, request);
|
||||
RSAflag.put("keyId", ppassInstant.getPassId() + "");
|
||||
return RSAflag.get("flag").equals("true") ? PREFIX + "passInstant.html" : "404.html";
|
||||
default:
|
||||
return "404.html";
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("download/{keyId}")
|
||||
@AuthToken
|
||||
@ResponseBody
|
||||
public String download(@PathVariable("keyId") String keyId, Model model, HttpServletRequest request, HttpServletResponse response,@RequestParam("username")String qianyiUser) throws Exception {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String username = redisTemplate.opsForValue().get(token);
|
||||
String key = downloadKeyByKeyId(keyId, username, qianyiUser);
|
||||
// 以流的形式下载文件。
|
||||
InputStream fis = new BufferedInputStream(new ByteArrayInputStream(key.getBytes("utf-8")));
|
||||
byte[] buffer = new byte[fis.available()];
|
||||
fis.read(buffer);
|
||||
fis.close();
|
||||
// 清空response
|
||||
response.reset();
|
||||
// 设置response的Header
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + new String("key.txt".getBytes()));
|
||||
response.addHeader("Content-Length", "" + key.length());
|
||||
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
|
||||
response.setContentType("application/octet-stream");
|
||||
toClient.write(buffer);
|
||||
toClient.flush();
|
||||
toClient.close();
|
||||
return "下载成功";
|
||||
}
|
||||
|
||||
@RequestMapping("update/{keyId}")
|
||||
@AuthToken
|
||||
@ResponseBody
|
||||
public String updateKey(@PathVariable("keyId") String keyId, HttpServletRequest request) throws Exception {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String username = redisTemplate.opsForValue().get(token);
|
||||
Map<String, String> keyDataMap = getKeyDataMap(keyId, username);
|
||||
String keytype = keyDataMap.get("keytype");
|
||||
deleteByKeyId(keyId,username);
|
||||
PpassInstant ppassInstant = new PpassInstant();
|
||||
ppassInstant.setPassType(keytype);
|
||||
ppassInstant.setPassId(Integer.parseInt(keyId)+1);
|
||||
ppassInstant.setPassName(keyId+" update key");
|
||||
ppassInstant.setPassExpiry(DateFormatUtils.format(DateUtils.rollMon(new Date(),1),"yyyy-MM-dd"));
|
||||
ppassInstant.setPassCreatetime(DateFormatUtils.format(new Date(), "yyyy-MM-dd hh:mm:ss"));
|
||||
return generateKeyAndUpload(ppassInstant,request);
|
||||
}
|
||||
|
||||
@RequestMapping("delete/{keyId}")
|
||||
@AuthToken
|
||||
@ResponseBody
|
||||
public String deleteKey(@PathVariable("keyId") String keyId, HttpServletRequest request) throws Exception {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String username = redisTemplate.opsForValue().get(token);
|
||||
String flag = deleteByKeyId(keyId, username);
|
||||
return flag.equals("true") ? "/passInstant" : "404.html";
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传推荐资料
|
||||
*/
|
||||
@RequestMapping(value = "/upload",method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String handleFileUpload(HttpServletRequest request, @RequestParam("file") MultipartFile file) throws Exception {
|
||||
if (!file.isEmpty()) {
|
||||
try {
|
||||
BufferedOutputStream out = new BufferedOutputStream(
|
||||
new FileOutputStream(new File(
|
||||
file.getOriginalFilename())));
|
||||
System.out.println(file.getName());
|
||||
out.write(file.getBytes());
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return "上传失败," + e.getMessage();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return "上传失败," + e.getMessage();
|
||||
}
|
||||
//上传文件路径
|
||||
String path = request.getServletContext().getRealPath("/systemFiles/");
|
||||
//上传文件名
|
||||
String filename = file.getOriginalFilename();
|
||||
File filepath = new File(path, filename);
|
||||
//判断路径是否存在,如果不存在就创建一个
|
||||
if (!filepath.getParentFile().exists()) {
|
||||
filepath.getParentFile().mkdirs();
|
||||
} //将上传文件保存到一个目标文件当中
|
||||
file.transferTo(new File(path + File.separator + filename));
|
||||
File readTxt = new File(path + File.separator + filename);
|
||||
BufferedReader reader = null;
|
||||
String tempString = null;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
try {
|
||||
// System.out.println("以行为单位读取文件内容,一次读一整行:");
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(readTxt),"UTF-8"));
|
||||
while ((tempString = reader.readLine()) != null) {
|
||||
sb.append(tempString);
|
||||
}
|
||||
reader.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(reader != null){
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
String keyStr = sb.toString();
|
||||
Gson gson = new Gson();
|
||||
PpassInstant ppassInstant = gson.fromJson(keyStr, PpassInstant.class);
|
||||
String priKey = resolveResponUtils.getGetResponseData("http://localhost:18087/remote/getSM2Pri/" + ppassInstant.getUsername(), null, "priKey");
|
||||
String fir = SM2Util.decrypt(priKey, ppassInstant.getPassChildfir());
|
||||
ppassInstant.setPassChildfir(fir);
|
||||
if(ppassInstant.getPassChildsec()!=null){
|
||||
String sec = SM2Util.decrypt(priKey, ppassInstant.getPassChildsec());
|
||||
ppassInstant.setPassChildsec(sec);
|
||||
Map<String,String> hashMap = new HashMap<>();
|
||||
hashMap.put("priKey",ppassInstant.getPassChildfir());
|
||||
hashMap.put("pubKey",ppassInstant.getPassChildsec());
|
||||
ppassInstant.setPassId(ppassInstant.getPassId() + 1 );
|
||||
Map<String, String> SM2flag = resolveSetPpassInstant(ppassInstant, request, hashMap);
|
||||
return SM2flag.get("flag").equals("true") ? "上传成功" : "404.html";
|
||||
}
|
||||
ppassInstant.setPassId(ppassInstant.getPassId() + 1 );
|
||||
Map<String, String> uploadKeyflag = resolveSetPpassInstant(ppassInstant, request,fir);
|
||||
return uploadKeyflag.get("flag").equals("true") ? "上传成功" : "404.html";
|
||||
} else {
|
||||
return "404.html";
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/passInstant_download/{ppassId}")
|
||||
public String passInstant_download(@PathVariable("ppassId")String ppassId,Model model){
|
||||
model.addAttribute("ppassId",ppassId);
|
||||
return PREFIX + "passInstant_download.html";
|
||||
}
|
||||
|
||||
private String deleteByKeyId(String keyId, String username) throws Exception {
|
||||
List<String> flagList = new ArrayList<>();
|
||||
flagList.add("flag");
|
||||
Map<String, String> flagMap = resolveResponUtils.getGetResponseDecryptData("http://localhost:18088/us-admin/remote/deleteKey/" + keyId + "/" + username, null, flagList);
|
||||
String flag = flagMap.get("flag");
|
||||
return flag;
|
||||
}
|
||||
|
||||
private String updateByKeyId(String keyId, String username) throws Exception {
|
||||
List<String> flagList = new ArrayList<>();
|
||||
flagList.add("flag");
|
||||
Map<String, String> flagMap = resolveResponUtils.getGetResponseDecryptData("http://localhost:18088/us-admin/remote/updateKey/" + keyId + "/" + username, null, flagList);
|
||||
String flag = flagMap.get("flag");
|
||||
return flag;
|
||||
}
|
||||
|
||||
private String downloadKeyByKeyId(String keyId, String username,String qianyiUser) throws Exception {
|
||||
String keyPass = resolveResponUtils.getGetResponseData("http://localhost:18087/remote/getKeyPass/" + username , null, "keyPass");
|
||||
Map<String, String> getKeyData = getKeyDataMap(keyId, username);
|
||||
String keydata = getKeyData.get("keydata");
|
||||
if (keydata.contains("pubKey:")) {
|
||||
String[] split = keydata.split("pubKey:");
|
||||
String[] split1 = split[1].split("priKey:");
|
||||
String pubKeyStr = new String(split1[0].getBytes());
|
||||
String priKeyStr = new String(split1[1].getBytes());
|
||||
String keyPubKey = resolveResponUtils.getGetResponseData("http://localhost:18087/remote/getSM2Pub/" + qianyiUser, null, "pubKey");
|
||||
String pubKey = Sm4Util.decryptEcb(keyPass, pubKeyStr);
|
||||
String priKey = Sm4Util.decryptEcb(keyPass, priKeyStr);
|
||||
String pubKeyEnc = SM2Util.encrypt(keyPubKey, pubKey);
|
||||
String priKeyEnc = SM2Util.encrypt(keyPubKey, priKey);
|
||||
PpassInstant ppassInstant = new PpassInstant();
|
||||
ppassInstant.setPassChildfir(pubKeyEnc);
|
||||
ppassInstant.setPassChildsec(priKeyEnc);
|
||||
ppassInstant.setPassType(getKeyData.get("keytype"));
|
||||
ppassInstant.setUsername(qianyiUser);
|
||||
ppassInstant.setPassId(Integer.parseInt(getKeyData.get("keyId")));
|
||||
Gson gson = new Gson();
|
||||
String keyJson = gson.toJson(ppassInstant);
|
||||
return keyJson;
|
||||
}
|
||||
String keyPubKey = resolveResponUtils.getGetResponseData("http://localhost:18087/remote/getSM2Pub/" + username, null, "pubKey");
|
||||
String keyEnc = Sm4Util.decryptEcb(keyPass,keydata);
|
||||
String encryptKey = SM2Util.encrypt(keyPubKey, keyEnc);
|
||||
PpassInstant ppassInstant = new PpassInstant();
|
||||
ppassInstant.setPassChildfir(encryptKey);
|
||||
ppassInstant.setPassType(getKeyData.get("keytype"));
|
||||
ppassInstant.setPassId(Integer.parseInt(getKeyData.get("keyId")));
|
||||
ppassInstant.setUsername(qianyiUser);
|
||||
Gson gson = new Gson();
|
||||
String keyJson = gson.toJson(ppassInstant);
|
||||
return keyJson;
|
||||
}
|
||||
|
||||
private Map<String, String> getKeyDataMap(String keyId, String username) throws Exception {
|
||||
List<String> keyStr = new ArrayList<>();
|
||||
keyStr.add("keydata");
|
||||
keyStr.add("keytype");
|
||||
keyStr.add("keyId");
|
||||
return resolveResponUtils.getGetResponseDecryptData("http://localhost:18088/us-admin/remote/getKeyById/" + keyId + "/" + username, null, keyStr);
|
||||
}
|
||||
|
||||
private Map<String, String> resolveSetSM2PpassInstantById(String keyId, PpassInstant ppassInstant, HttpServletRequest request, Map<String, String> key) throws Exception {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String userName = redisTemplate.opsForValue().get(token);
|
||||
String postJson = getKeyPostBody(ppassInstant, key, userName,token);
|
||||
List<String> strList = new ArrayList<>();
|
||||
strList.add("flag");
|
||||
return resolveResponUtils.getPostJsonResponseDecryptData("http://localhost:18088/us-admin/remote/keyUploadJson/" + keyId + "/" + userName, postJson, strList);
|
||||
}
|
||||
|
||||
private Map<String, String> resolveSetPpassInstantById(String keyId, PpassInstant ppassInstant, HttpServletRequest request, String key) throws Exception {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String userName = redisTemplate.opsForValue().get(token);
|
||||
String postJson = getKeyPostBody(ppassInstant, key, userName, token);
|
||||
List<String> strList = new ArrayList<>();
|
||||
strList.add("flag");
|
||||
return resolveResponUtils.getPostJsonResponseDecryptData("http://localhost:18088/us-admin/remote/keyUploadJson/" + keyId + "/" + userName, postJson, strList);
|
||||
}
|
||||
|
||||
private String getKeyPostBody(PpassInstant ppassInstant, Map<String, String> key, String userName, String token) throws Exception {
|
||||
String keyPass = resolveResponUtils.getGetResponseData("http://localhost:18087/remote/getKeyPass/" + userName , null, "keyPass");
|
||||
String privateKey = Sm4Util.encryptEcb(keyPass, key.get("priKey"));
|
||||
String publicKey = Sm4Util.encryptEcb(keyPass, key.get("pubKey"));
|
||||
key.put("priKey",privateKey);
|
||||
key.put("pubKey",publicKey);
|
||||
ppassInstant.setPassCreatetime(DateFormatUtils.format(new Date(), "yyyy-MM-dd hh:mm:ss"));
|
||||
ppassInstant.setPassExpiry(DateFormatUtils.format(DateUtils.rollDay(new Date(), 31), "yyyy-MM-dd"));
|
||||
ppassInstant.setPassLength(new String(privateKey).length());
|
||||
ppassInstant.setPassChildfir(privateKey);
|
||||
ppassInstant.setPassChildsec(publicKey);
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(ppassInstant);
|
||||
}
|
||||
|
||||
private String getKeyPostBody(PpassInstant ppassInstant, String key, String userName, String token) throws Exception {
|
||||
String keyPass = resolveResponUtils.getGetResponseData("http://localhost:18087/remote/getKeyPass/" + userName , null, "keyPass");
|
||||
String priKeyStr = Sm4Util.encryptEcb(keyPass, key);
|
||||
ppassInstant.setPassCreatetime(DateFormatUtils.format(new Date(), "yyyy-MM-dd hh:mm:ss"));
|
||||
ppassInstant.setPassExpiry(DateFormatUtils.format(DateUtils.rollDay(new Date(), 31), "yyyy-MM-dd"));
|
||||
ppassInstant.setPassLength(key.length());
|
||||
ppassInstant.setPassChildfir(priKeyStr);
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(ppassInstant);
|
||||
}
|
||||
|
||||
private Map<String, String> getSM2KeyPairToJSON() {
|
||||
PCIKeyPair pciKeyPair = SM2Util.genKeyPair();
|
||||
String priKey = pciKeyPair.getPriKey();
|
||||
String pubKey = pciKeyPair.getPubKey();
|
||||
Map<String, String> hashMap = new HashMap<>();
|
||||
hashMap.put("priKey", priKey);
|
||||
hashMap.put("pubKey", pubKey);
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
private Map<String, String> resolveSetPpassInstant(@ModelAttribute PpassInstant ppassInstant, HttpServletRequest request, String key) throws Exception {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String userName = redisTemplate.opsForValue().get(token);
|
||||
String postJson = getKeyPostBody(ppassInstant, key, userName, token);
|
||||
List<String> strList = new ArrayList<>();
|
||||
strList.add("flag");
|
||||
strList.add("keyId");
|
||||
Map<String, String> postList = resolveResponUtils.getPostJsonResponseDecryptData("http://localhost:18088/us-admin/remote/keySaveJson/" + userName, postJson, strList);
|
||||
return postList;
|
||||
}
|
||||
|
||||
private Map<String, String> resolveSetPpassInstant(@ModelAttribute PpassInstant ppassInstant, HttpServletRequest request, Map<String, String> key) throws Exception {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String userName = redisTemplate.opsForValue().get(token);
|
||||
String postJson = getKeyPostBody(ppassInstant, key, userName,token);
|
||||
List<String> strList = new ArrayList<>();
|
||||
strList.add("flag");
|
||||
strList.add("keyId");
|
||||
Map<String, String> postList = resolveResponUtils.getPostJsonResponseDecryptData("http://localhost:18088/us-admin/remote/keySaveJson/" + userName, postJson, strList);
|
||||
return postList;
|
||||
}
|
||||
|
||||
private Map<String, String> generateAESKey(PpassInstant ppassInstant, HttpServletRequest request) throws Exception {
|
||||
String AESkey = Generatingkey.getAESKey();
|
||||
return resolveSetPpassInstant(ppassInstant, request, AESkey);
|
||||
}
|
||||
|
||||
private Map<String, String> generateDESKey(PpassInstant ppassInstant, HttpServletRequest request) throws Exception {
|
||||
String DESkey = Generatingkey.getDESKey();
|
||||
return resolveSetPpassInstant(ppassInstant, request, DESkey);
|
||||
}
|
||||
|
||||
private Map<String, String> getRSAKeyPairToJSON() throws Exception {
|
||||
PCIKeyPair pciKeyPair = SM2Util.genKeyPair();
|
||||
String priKey = RSAUtils.getPriKey();
|
||||
String pubKey = RSAUtils.getPubKey();
|
||||
Map<String, String> hashMap = new HashMap<>();
|
||||
hashMap.put("priKey", priKey);
|
||||
hashMap.put("pubKey", pubKey);
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
private Map<String, String> generateRSAkey(PpassInstant ppassInstant, HttpServletRequest request) throws Exception {
|
||||
Map<String, String> RSAkey = getRSAKeyPairToJSON();
|
||||
return resolveSetPpassInstant(ppassInstant, request, RSAkey);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.passuser.net.controller.notice;
|
||||
|
||||
import com.passuser.net.annotation.AuthToken;
|
||||
import com.passuser.net.utils.R;
|
||||
import com.passuser.net.utils.ResolveResponUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
|
||||
public class NoticeController {
|
||||
|
||||
@Autowired
|
||||
private ResolveResponUtils resolveResponUtils;
|
||||
@RequestMapping("notice")
|
||||
@AuthToken
|
||||
@ResponseBody
|
||||
public R getUserNotice(HttpServletRequest request) throws Exception {
|
||||
String user = (String)request.getAttribute("user");
|
||||
Map<String ,String> noticelist = resolveResponUtils.getGetResponseDecryptData("http://localhost:18088/notice/" + user, null, Arrays.asList("noticelist"));
|
||||
return new R().put("noticelist",noticelist.get("noticelist"));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,157 @@
|
||||
package com.passuser.net.controller.user;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import com.passuser.net.KeyUtils.Sm4Util;
|
||||
import com.passuser.net.annotation.AuthToken;
|
||||
import com.passuser.net.utils.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
public class UserController {
|
||||
|
||||
// 注入Md5TokenGenerator
|
||||
@Resource
|
||||
Md5TokenGenerator tokenGenerator;
|
||||
|
||||
// 注入ResolveResponUtils
|
||||
@Autowired
|
||||
private ResolveResponUtils resolveResponUtils;
|
||||
|
||||
// 注入RedisTemplate
|
||||
@Resource
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
// 登录接口
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
public String loginUserBySM4(@RequestParam("username") String username, @RequestParam("password") String password, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
Gson gson = new Gson();
|
||||
hashMap.put("username", username);
|
||||
hashMap.put("password", password);
|
||||
// 发送post请求获取sessionkey
|
||||
String post = HttpUtils.post("http://localhost:18087/remote/getSessionKey", hashMap);
|
||||
Map<String ,Object> map = new HashMap<>();
|
||||
Map<String ,Object> publicKey = gson.fromJson(post, map.getClass());
|
||||
String sessionkey = (String) publicKey.get("sessionkey");
|
||||
// 将sessionkey存入redis
|
||||
redisTemplate.opsForValue().set("sessionkey", sessionkey);
|
||||
// 将用户信息加密
|
||||
String jsonUserName = gson.toJson(hashMap);
|
||||
String userEncrypt = Sm4Util.encryptEcb(sessionkey, jsonUserName);
|
||||
HashMap<String, String> userInfos = new HashMap<>();
|
||||
userInfos.put("username", username);
|
||||
userInfos.put("userEncrypt", userEncrypt);
|
||||
// 发送post请求进行认证
|
||||
String userPost = HttpUtils.post("http://localhost:18088/us-admin/remote/remoteauth", userInfos);
|
||||
Map<String ,Object> r = gson.fromJson(userPost, map.getClass());
|
||||
Boolean auth = (Boolean) r.get("auth");
|
||||
if (Boolean.TRUE.equals(auth)) {
|
||||
// 获取keyPass
|
||||
String keyPass = resolveResponUtils.getGetResponseData("http://localhost:18087/remote/getKeyPass/" + username, null, "keyPass");
|
||||
// 生成token
|
||||
String token = tokenGenerator.generate(username, password);
|
||||
// 设置cookie和header
|
||||
CookieUtils.setCookie(request,response,"Authorization", token);
|
||||
response.setHeader("Authorization", token);
|
||||
// 将token和用户名存入redis
|
||||
redisTemplate.opsForValue().set(token, username);
|
||||
redisTemplate.opsForValue().set(token+username,System.currentTimeMillis()+"");
|
||||
}
|
||||
if (Boolean.TRUE.equals(auth)) {
|
||||
return "/PassInstant/passInstant/passInstant.html";
|
||||
} else {
|
||||
return "login.html";
|
||||
}
|
||||
}
|
||||
|
||||
// 获取登录页面
|
||||
@RequestMapping(value = {"/login", "/"}, method = RequestMethod.GET)
|
||||
public String getLoginPage(HttpServletRequest request,HttpServletResponse response) {
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
if (!StringUtils.isNullOrEmpty(token) && redisTemplate.opsForValue().get(token) != null) {
|
||||
return "/PassInstant/passInstant/passInstant.html";
|
||||
}
|
||||
|
||||
return "/login.html";
|
||||
}
|
||||
|
||||
// 登出接口
|
||||
@RequestMapping("logout")
|
||||
public String logout(HttpServletRequest request,HttpServletResponse response){
|
||||
// 删除cookie
|
||||
CookieUtils.deleteCookie(request,response,"Authorization");
|
||||
// 清除session
|
||||
Enumeration em = request.getSession().getAttributeNames();
|
||||
while(em.hasMoreElements()){
|
||||
request.getSession().removeAttribute(em.nextElement().toString());
|
||||
}
|
||||
return "login.html";
|
||||
}
|
||||
|
||||
// 获取用户注册页面
|
||||
@RequestMapping("/user_userAdd")
|
||||
public String getUserRegister(){
|
||||
return "/system/user/user_teacherAdd.html";
|
||||
}
|
||||
|
||||
// 获取修改密码页面
|
||||
@RequestMapping("/changePassword")
|
||||
public String changPassword(){
|
||||
return "/system/user/user_changPwd";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
@RequestMapping(value = "/changPassword",method = RequestMethod.POST)
|
||||
@AuthToken
|
||||
public String addUser(@RequestParam("oldpassword") String oldpassword, @RequestParam("firpassword") String firpassword, @RequestParam("secpassword") String secpassword, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
String token = CookieUtils.getCookieValue(request, "Authorization");
|
||||
String username = redisTemplate.opsForValue().get(token);
|
||||
if (!firpassword.equals(secpassword)) {
|
||||
return "404.html";
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
hashMap.put("oldpassword", oldpassword);
|
||||
hashMap.put("newpassword", firpassword);
|
||||
hashMap.put("username", username);
|
||||
String hashMapJson = gson.toJson(hashMap);
|
||||
String sessionkey = redisTemplate.opsForValue().get("sessionkey");
|
||||
String userEncrypt = Sm4Util.encryptEcb(sessionkey, hashMapJson);
|
||||
R r = R.ok().put("encryptData", userEncrypt);
|
||||
String postJson = gson.toJson(r);
|
||||
// 发送post请求修改密码
|
||||
String flag = resolveResponUtils.getPostJsonResponseData("http://localhost:18088/us-admin/remote/changpwd/" + username, postJson, "flag");
|
||||
return flag.equals("true")?"redirect:/passInstant":"404.html";
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*/
|
||||
@RequestMapping(value = "register",method = RequestMethod.POST)
|
||||
public String register(@RequestParam("username")String username,@RequestParam("password")String password,@RequestParam("keypass")String keypass) throws Exception {
|
||||
Map<String,String> hashMap = new HashMap<>();
|
||||
hashMap.put("username",username);
|
||||
hashMap.put("password",password);
|
||||
Map<String,String> keyPass = new HashMap<>();
|
||||
keyPass.put("keyPass",keypass);
|
||||
// 发送post请求注册用户
|
||||
String flag = resolveResponUtils.getPostResponseData("http://localhost:18088/us-admin/remote/register/", hashMap, "flag");
|
||||
// 发送post请求保存keyPass
|
||||
resolveResponUtils.getPostResponseData("http://localhost:18087/remote/savekeypass/"+username, keyPass, "flag");
|
||||
return flag.equals("true")?"redirect:/login":"404.html";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.passuser.net.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: Token实体类
|
||||
* @author: Yangxf
|
||||
* @date: 2019/4/14 12:53
|
||||
*/
|
||||
@Data
|
||||
public class TokenEntity {
|
||||
|
||||
/* 用户ID */
|
||||
private Long userName;
|
||||
|
||||
/* 刷新时间 */
|
||||
private int buildTime;
|
||||
|
||||
/* token */
|
||||
private String token;
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.scorpios.tokenauthentication.model;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
public class ResponseTemplate {
|
||||
|
||||
public Integer code;
|
||||
|
||||
public String message;
|
||||
|
||||
public Object data;
|
||||
|
||||
}
|
||||
@ -0,0 +1,417 @@
|
||||
package com.passuser.net.utils;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName: CommonUtils
|
||||
* @Description: 通用工具类
|
||||
* @since: 0.0.1
|
||||
* @author: dzy
|
||||
* @date: 2017年2月22日 上午11:46:44
|
||||
*/
|
||||
public class CommonUtils {
|
||||
|
||||
|
||||
/**
|
||||
* @param date 日期
|
||||
* @param pattern 模式 如:yyyyMMdd等
|
||||
* @return
|
||||
* @Title: formatDate
|
||||
* @Description: 格式化日期
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String formatDate(Date date, String pattern) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(pattern);
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param strDate String类型日期
|
||||
* @param pattern 日期显示模式
|
||||
* @return
|
||||
* @Title: parseDate
|
||||
* @Description: 将String日期转换为Date类型日期
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static Date parseDate(String strDate, String pattern) {
|
||||
SimpleDateFormat formatter = null;
|
||||
if (StringUtils.isEmpty(strDate) || strDate.equals("")) {
|
||||
return null;
|
||||
}
|
||||
formatter = new SimpleDateFormat(pattern);
|
||||
try {
|
||||
return formatter.parse(strDate);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date 操作前的日期
|
||||
* @param field 日期的部分如:年,月,日
|
||||
* @param amount 增加或减少的值(负数表示减少)
|
||||
* @return
|
||||
* @Title: dateAdd
|
||||
* @Description: 日期的加减操作
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static Date dateAdd(Date date, int field, int amount) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(field, amount);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param source 源字符串
|
||||
* @param offset 填充开始的位置, 0-在左边, source.getBytes().length 在右边, 如果有中文时需小心位置
|
||||
* @param c 用于填充的字符
|
||||
* @param length 最后字符串的字节长度
|
||||
* @return
|
||||
* @Title: fill
|
||||
* @Description: 填充字符串, 长度是按字节计算, 不是字符
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String fill(String source, int offset, char c, int length) throws UnsupportedEncodingException {
|
||||
if (null == source) {
|
||||
source = "";
|
||||
}
|
||||
if (source.getBytes("utf-8").length == length) {
|
||||
return source;
|
||||
}
|
||||
byte[] buf = new byte[length];
|
||||
byte[] src = source.getBytes("utf-8");
|
||||
if (src.length > length) {
|
||||
System.arraycopy(src, src.length - length, buf, 0, length);
|
||||
return new String(buf, "utf-8");
|
||||
}
|
||||
if (offset > src.length) {
|
||||
offset = src.length;
|
||||
} else if (offset < 0) {
|
||||
offset = 0;
|
||||
}
|
||||
int n = length - src.length;
|
||||
|
||||
System.arraycopy(src, 0, buf, 0, offset);
|
||||
for (int i = 0; i < n; i++) {
|
||||
buf[i + offset] = (byte) c;
|
||||
}
|
||||
System.arraycopy(src, offset, buf, offset + n, src.length - offset);
|
||||
return new String(buf, "utf-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param original 原字符串
|
||||
* @param offset 填充开始的位置, 0-在左边, original.getBytes().length 在右边, 如果有中文时需小心位置
|
||||
* @param length 替换的字节数
|
||||
* @param c 用于替换的字符
|
||||
* @return
|
||||
* @Title: replace
|
||||
* @Description: 替换字符串, 长度是按字节计算, 不是字符
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String replace(String original, int offset, int length, char c) throws UnsupportedEncodingException {
|
||||
if (original == null) {
|
||||
original = "";
|
||||
}
|
||||
if (original.getBytes("utf-8").length <= offset) {
|
||||
return original;
|
||||
}
|
||||
if (original.getBytes("utf-8").length < offset + length) {
|
||||
length = original.getBytes("utf-8").length - offset;
|
||||
}
|
||||
byte[] buf = new byte[original.length()];
|
||||
byte[] src = original.getBytes("utf-8");
|
||||
System.arraycopy(src, 0, buf, 0, offset);
|
||||
|
||||
for (int i = offset; i < offset + length; i++) {
|
||||
buf[i] = (byte) c;
|
||||
}
|
||||
System.arraycopy(src, offset + length, buf, offset + length, src.length - offset - length);
|
||||
return new String(buf, "utf-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param s 16进制字符串
|
||||
* @return
|
||||
* @Title: hexToByte
|
||||
* @Description: 16进制字符串转字节数组
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static byte[] hexToByte(String s) {
|
||||
byte[] result = null;
|
||||
try {
|
||||
int i = s.length();
|
||||
// if (i % 2 == 1) {
|
||||
// throw new Exception("字符串长度不是偶数.");
|
||||
// }
|
||||
if (i % 2 != 0) {
|
||||
throw new Exception("字符串长度不是偶数.");
|
||||
}
|
||||
result = new byte[i / 2];
|
||||
for (int j = 0; j < result.length; j++) {
|
||||
result[j] = (byte) Integer.parseInt(s.substring(j * 2, j * 2 + 2), 16);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result = null;
|
||||
e.printStackTrace();
|
||||
// log.error("16进制字符串转字节数组时出现异常:", e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bytes 字节数组
|
||||
* @return
|
||||
* @Title: byte2hexString
|
||||
* @Description: 字节数组转换为16进制字符串 //0x33 0xD2 0x00 0x46 转换为 "33d20046" 转换和打印报文用
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String byte2hexString(byte[] bytes) {
|
||||
StringBuffer buf = new StringBuffer(bytes.length * 2);
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
if (((int) bytes[i] & 0xff) < 0x10) {
|
||||
buf.append("0");
|
||||
}
|
||||
buf.append(Long.toString((int) bytes[i] & 0xff, 16));
|
||||
}
|
||||
return buf.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hexString 16进制字符串 如:"33d20046" 转换为 0x33 0xD2 0x00 0x46
|
||||
* @return
|
||||
* @Title: hexString2byte
|
||||
* @Description: 16进制字符串转字节数组
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static byte[] hexString2byte(String hexString) {
|
||||
if (null == hexString || hexString.length() % 2 != 0 || hexString.contains("null")) {
|
||||
return null;
|
||||
}
|
||||
byte[] bytes = new byte[hexString.length() / 2];
|
||||
for (int i = 0; i < hexString.length(); i += 2) {
|
||||
bytes[i / 2] = (byte) (Integer.parseInt(hexString.substring(i, i + 2), 16) & 0xff);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i 需要转的int类型数字
|
||||
* @return
|
||||
* @Title: byte1ToBcd2
|
||||
* @Description: int类型转BCD码
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String byte1ToBcd2(int i) {
|
||||
// return (new Integer(i / 16).toString() + (new Integer(i % 16)).toString());
|
||||
return Integer.toString(i / 16) + Integer.toString(i % 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b 字节数组
|
||||
* @return
|
||||
* @Title: byteToHex2
|
||||
* @Description: 字节数组转换为16进制字符串 For example, byte[] {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF} will be changed to String "0123456789ABCDEF"
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String byteToHex2(byte[] b) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
String tmp = "";
|
||||
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
tmp = Integer.toHexString(b[i] & 0xff);
|
||||
if (tmp.length() == 1) {
|
||||
result.append("0" + tmp);
|
||||
} else {
|
||||
result.append(tmp);
|
||||
}
|
||||
}
|
||||
return result.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param num 数字
|
||||
* @param len 字节数组长度
|
||||
* @return
|
||||
* @Title: intToHexBytes
|
||||
* @Description: int类型转16进制字节数组
|
||||
*/
|
||||
public static byte[] intToHexBytes(int num, int len) {
|
||||
byte[] bytes = null;
|
||||
String hexString = Integer.toHexString(num);
|
||||
if (len > 0) {
|
||||
int length = len * 2;
|
||||
hexString = leftFill(hexString, '0', length);
|
||||
bytes = CommonUtils.hexString2byte(hexString);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private static String leftFill(String hexString, char c, int length) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if(hexString.length() < length){
|
||||
for(int count = 0; count <length-hexString.length();count++){
|
||||
stringBuilder.append(c);
|
||||
}
|
||||
}
|
||||
return stringBuilder.append(hexString).toString();
|
||||
}
|
||||
|
||||
/*public static String byteToHex3(byte[] b) {
|
||||
String result = "";
|
||||
String tmp = "";
|
||||
|
||||
for (int n = 0; n < b.length; n++) {
|
||||
tmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
|
||||
if (tmp.length() == 1) {
|
||||
result = result + "0" + tmp;
|
||||
} else {
|
||||
result = result + tmp;
|
||||
}
|
||||
if (n < b.length - 1) {
|
||||
result = result + "";
|
||||
}
|
||||
}
|
||||
return result.toUpperCase();
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @param str 需要转换编码的字符串
|
||||
* @return
|
||||
* @Title: iso2Gbk
|
||||
* @Description: 将ISO-8859-1编码的字符串转成GBK编码的字符串
|
||||
* @since: 0.0.1
|
||||
*/
|
||||
public static String iso2Gbk(String str) {
|
||||
if (null == str) {
|
||||
return str;
|
||||
}
|
||||
try {
|
||||
return new String(str.getBytes("ISO-8859-1"), "GBK");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// log.error("不支持的编码异常:", e);
|
||||
e.printStackTrace();
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @param message
|
||||
// * @return
|
||||
// * @Title: getSubElement
|
||||
// * @Description: 分解各子域到HashMap
|
||||
// * @since: 0.0.1
|
||||
// */
|
||||
// public static Map<String, String> getSubElement(byte[] message) {
|
||||
// Map<String, String> map = new HashMap<String, String>();
|
||||
// String key = null;
|
||||
// String value = null;
|
||||
// int len = 0;
|
||||
// int idx = 0;
|
||||
// while (idx < message.length) {
|
||||
// key = new String(message, idx, 2);
|
||||
// idx += 2; //取了SE id 移2位
|
||||
// len = Integer.parseInt(new String(message, idx, 2));
|
||||
// idx += 2; //取了SE id的内容长度 移2位
|
||||
// value = new String(message, idx, len);
|
||||
// map.put(key, value);
|
||||
// idx += len;
|
||||
// }
|
||||
// return map;
|
||||
// }
|
||||
|
||||
//byte数组转成long
|
||||
|
||||
/**
|
||||
* @param b 将字节数组转long类型 位置为小端
|
||||
* @return
|
||||
*/
|
||||
public static long byteToLong(byte[] b) {
|
||||
long s = 0;
|
||||
long s0 = b[0] & 0xff;// 最低位
|
||||
long s1 = b[1] & 0xff;
|
||||
long s2 = b[2] & 0xff;
|
||||
long s3 = b[3] & 0xff;
|
||||
long s4 = b[4] & 0xff;// 最低位
|
||||
long s5 = b[5] & 0xff;
|
||||
long s6 = b[6] & 0xff;
|
||||
long s7 = b[7] & 0xff;
|
||||
|
||||
// s0不变
|
||||
s1 <<= 8;
|
||||
s2 <<= 16;
|
||||
s3 <<= 24;
|
||||
s4 <<= 8 * 4;
|
||||
s5 <<= 8 * 5;
|
||||
s6 <<= 8 * 6;
|
||||
s7 <<= 8 * 7;
|
||||
s = s0 | s1 | s2 | s3 | s4 | s5 | s6 | s7;
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b 将字节数组转int类型 位置为小端
|
||||
* @return
|
||||
*/
|
||||
public static int byteToInt(byte[] b) {
|
||||
int s = 0;
|
||||
int s0 = b[0] & 0xff;// 最低位
|
||||
int s1 = b[1] & 0xff;
|
||||
int s2 = b[2] & 0xff;
|
||||
int s3 = b[3] & 0xff;
|
||||
|
||||
// s0不变
|
||||
s1 <<= 8;
|
||||
s2 <<= 16;
|
||||
s3 <<= 24;
|
||||
|
||||
s = s0 | s1 | s2 | s3;
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* int类型转换小端的byte数组
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public static byte[] intToLittleBytes(int i) {
|
||||
ByteBuffer byteBuffer = ByteBuffer.allocate(4);
|
||||
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
byteBuffer.asIntBuffer().put(i);
|
||||
byte[] littleBytes = byteBuffer.array();
|
||||
return littleBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将一个字节转成10进制
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
public static int byteToInt(byte b) {
|
||||
int value = b & 0xff;
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节数组合并
|
||||
* @param bt1 字节数组bt1
|
||||
* @param bt2 字节数组bt2
|
||||
* @return
|
||||
*/
|
||||
public static byte[] byteMerger(byte[] bt1, byte[] bt2){
|
||||
byte[] bt3 = new byte[bt1.length+bt2.length];
|
||||
System.arraycopy(bt1, 0, bt3, 0, bt1.length);
|
||||
System.arraycopy(bt2, 0, bt3, bt1.length, bt2.length);
|
||||
return bt3;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,21 @@
|
||||
package com.passuser.net.utils;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
|
||||
@Component
|
||||
public class Md5TokenGenerator implements TokenGenerator {
|
||||
|
||||
@Override
|
||||
public String generate(String... strings) {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
String tokenMeta = "";
|
||||
for (String s : strings) {
|
||||
tokenMeta = tokenMeta + s;
|
||||
}
|
||||
tokenMeta = tokenMeta + timestamp;
|
||||
String token = DigestUtils.md5DigestAsHex(tokenMeta.getBytes());
|
||||
return token;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.passuser.net.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class R extends HashMap<String, Object> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public R() {
|
||||
put("code", 200);
|
||||
}
|
||||
|
||||
public static R error() {
|
||||
return error(500, "未知异常,请联系管理员");
|
||||
}
|
||||
|
||||
public static R error(String msg) {
|
||||
return error(500, msg);
|
||||
}
|
||||
|
||||
public static R error(int code, String msg) {
|
||||
R r = new R();
|
||||
r.put("code", code);
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(String msg) {
|
||||
R r = new R();
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(Map<String, Object> map) {
|
||||
R r = new R();
|
||||
r.putAll(map);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok() {
|
||||
return new R();
|
||||
}
|
||||
|
||||
public R put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
package com.passuser.net.utils;
|
||||
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.security.Key;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class RSAUtils {
|
||||
|
||||
|
||||
|
||||
public class Keys {
|
||||
|
||||
}
|
||||
|
||||
public static final String KEY_ALGORITHM = "RSA";
|
||||
//public static final String SIGNATURE_ALGORITHM = "MD5withRSA";
|
||||
private static final String PUBLIC_KEY = "RSAPublicKey";
|
||||
private static final String PRIVATE_KEY = "RSAPrivateKey";
|
||||
|
||||
//获得公钥
|
||||
public static String getPublicKey(Map<String, Object> keyMap) throws Exception {
|
||||
//获得map中的公钥对象 转为key对象
|
||||
Key key = (Key) keyMap.get(PUBLIC_KEY);
|
||||
//byte[] publicKey = key.getEncoded();
|
||||
//编码返回字符串
|
||||
return encryptBASE64(key.getEncoded());
|
||||
}
|
||||
|
||||
//获得私钥
|
||||
public static String getPrivateKey(Map<String, Object> keyMap) throws Exception {
|
||||
//获得map中的私钥对象 转为key对象
|
||||
Key key = (Key) keyMap.get(PRIVATE_KEY);
|
||||
//byte[] privateKey = key.getEncoded();
|
||||
//编码返回字符串
|
||||
return encryptBASE64(key.getEncoded());
|
||||
}
|
||||
|
||||
//解码返回byte
|
||||
public static byte[] decryptBASE64(String key) throws Exception {
|
||||
return (new BASE64Decoder()).decodeBuffer(key);
|
||||
}
|
||||
|
||||
//编码返回字符串
|
||||
public static String encryptBASE64(byte[] key) throws Exception {
|
||||
return (new BASE64Encoder()).encodeBuffer(key);
|
||||
}
|
||||
|
||||
//map对象中存放公私钥
|
||||
public static Map<String, Object> initKey() throws Exception {
|
||||
//获得对象 KeyPairGenerator 参数 RSA 1024个字节
|
||||
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM);
|
||||
keyPairGen.initialize(1024);
|
||||
//通过对象 KeyPairGenerator 获取对象KeyPair
|
||||
KeyPair keyPair = keyPairGen.generateKeyPair();
|
||||
|
||||
//通过对象 KeyPair 获取RSA公私钥对象RSAPublicKey RSAPrivateKey
|
||||
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
//公私钥对象存入map中
|
||||
Map<String, Object> keyMap = new HashMap<String, Object>(2);
|
||||
keyMap.put(PUBLIC_KEY, publicKey);
|
||||
keyMap.put(PRIVATE_KEY, privateKey);
|
||||
return keyMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getPriKey() throws Exception {
|
||||
Map<String, Object> keyMap;
|
||||
keyMap = initKey();
|
||||
//String publicKey = getPublicKey(keyMap);
|
||||
//System.out.println(publicKey);
|
||||
String privateKey = getPrivateKey(keyMap);
|
||||
//System.out.println(privateKey);
|
||||
//return privateKey;
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
public static String getPubKey() throws Exception {
|
||||
Map<String, Object> keyMap;
|
||||
keyMap = initKey();
|
||||
String publicKey = getPublicKey(keyMap);
|
||||
//System.out.println(publicKey);
|
||||
//String privateKey = getPrivateKey(keyMap);
|
||||
//System.out.println(privateKey);
|
||||
return publicKey;
|
||||
}
|
||||
/*
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
String privateKey =getPriKey();
|
||||
String publicKey =getPubKey();
|
||||
|
||||
System.out.println(publicKey);
|
||||
|
||||
System.out.println(privateKey);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
package com.passuser.net.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.passuser.net.KeyUtils.Sm4Util;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ResolveResponUtils {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private Map<String ,Object> map = new HashMap<>();
|
||||
|
||||
public Map<String ,Object> resolveGetRespons(String url, Map<String, String> paramsMap){
|
||||
String getRanStr = HttpUtils.get(url, paramsMap);
|
||||
return getResponse(getRanStr);
|
||||
}
|
||||
|
||||
public Map<String ,Object> resolvePostRespons(String url, Map<String, String> paramsMap){
|
||||
String getRanStr = HttpUtils.post(url, paramsMap);
|
||||
return getResponse(getRanStr);
|
||||
}
|
||||
|
||||
public Map<String ,Object> resolvePostJsonRespons(String url, String postJson){
|
||||
String getRanStr = HttpUtils.HttpPostWithJson(url, postJson);
|
||||
return getResponse(getRanStr);
|
||||
}
|
||||
|
||||
public String getGetResponseData(String url,Map<String, String> paramsMap, String dataKey) throws Exception {
|
||||
String getRanStr = HttpUtils.get(url, paramsMap);
|
||||
return dealGetResponseData(dataKey, getRanStr);
|
||||
}
|
||||
|
||||
public String getPostJsonResponseData(String url,String postJson, String dataKey) throws Exception {
|
||||
String getRanStr = HttpUtils.HttpPostWithJson(url, postJson);
|
||||
return dealGetResponseData(dataKey, getRanStr);
|
||||
}
|
||||
|
||||
public String getPostResponseData(String url,Map<String, String> paramsMap, String dataKey) throws Exception {
|
||||
String getRanStr = HttpUtils.post(url, paramsMap);
|
||||
return dealGetResponseData(dataKey, getRanStr);
|
||||
}
|
||||
|
||||
public Map<String ,String> getGetResponseDecryptData(String url,Map<String, String> paramsMap, List<String> dataKey) throws Exception {
|
||||
String getRanStr = HttpUtils.get(url, paramsMap);
|
||||
return dealResponseDecryptData(getRanStr,dataKey);
|
||||
}
|
||||
|
||||
public Map<String ,String> getPostResponseDecryptData(String url,Map<String, String> paramsMap, List<String> dataKey) throws Exception {
|
||||
String getRanStr = HttpUtils.post(url, paramsMap);
|
||||
return dealResponseDecryptData( getRanStr,dataKey);
|
||||
}
|
||||
|
||||
public Map<String ,String> getPostJsonResponseDecryptData(String url, String postjson, List<String> dataKey) throws Exception {
|
||||
String getRanStr = HttpUtils.HttpPostWithJson(url, postjson);
|
||||
return dealResponseDecryptData( getRanStr,dataKey);
|
||||
}
|
||||
|
||||
private Map<String ,String> dealResponseDecryptData(String getRanStr, List<String> dataKey) throws Exception {
|
||||
String sessionkey = redisTemplate.opsForValue().get("sessionkey");
|
||||
Map<String ,Object> response = getResponse(getRanStr);
|
||||
Map<String ,String> perDatas = new HashMap<>();
|
||||
if(response!= null){
|
||||
for (String key : dataKey) {
|
||||
perDatas.put(key,Sm4Util.decryptEcb(sessionkey, response.get(key).toString()));
|
||||
}
|
||||
}else{
|
||||
throw new Exception("Response is not defined");
|
||||
}
|
||||
return perDatas;
|
||||
}
|
||||
|
||||
private String dealResponseListDecryptData(String dataKey, String getRanStr) throws Exception {
|
||||
String sessionkey = redisTemplate.opsForValue().get("sessionkey");
|
||||
Map<String ,Object> response = getResponse(getRanStr);
|
||||
String perData = "";
|
||||
if(response!= null){
|
||||
perData = Sm4Util.decryptEcb(sessionkey, response.get(dataKey).toString());
|
||||
}else{
|
||||
throw new Exception("Response is not defined");
|
||||
}
|
||||
return perData;
|
||||
}
|
||||
|
||||
|
||||
private String dealGetResponseData(String dataKey, String getRanStr) {
|
||||
Map<String, Object> response = getResponse(getRanStr);
|
||||
String perData;
|
||||
if (response != null) {
|
||||
perData = response.get(dataKey).toString();
|
||||
} else {
|
||||
throw new NullPointerException("Response is not defined");
|
||||
}
|
||||
return perData;
|
||||
}
|
||||
|
||||
|
||||
private Map<String ,Object> getResponse(String getRanStr) {
|
||||
Gson gson = new Gson();
|
||||
return gson.fromJson(getRanStr, map.getClass());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.passuser.net.utils;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public interface TokenGenerator {
|
||||
|
||||
public String generate(String... strings);
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>密钥管理管理</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="row row-lg">
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<#NameCon id="condition" name="名称" />
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<#button name="搜索" icon="fa-search" clickFun="PassInstant.search()"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden-xs" id="PassInstantTableToolbar" role="group">
|
||||
@if(shiro.hasPermission("/passInstant/add")){
|
||||
<#button name="添加" icon="fa-plus" clickFun="PassInstant.openAddPassInstant()"/>
|
||||
@}
|
||||
@if(shiro.hasPermission("/passInstant/update")){
|
||||
<#button name="修改" icon="fa-edit" clickFun="PassInstant.openPassInstantDetail()" space="true"/>
|
||||
@}
|
||||
@if(shiro.hasPermission("/passInstant/delete")){
|
||||
<#button name="删除" icon="fa-remove" clickFun="PassInstant.delete()" space="true"/>
|
||||
@}
|
||||
</div>
|
||||
<#table id="PassInstantTable"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="${ctxPath}/static/modular/PassInstant/passInstant/passInstant.js"></script>
|
||||
@}
|
||||
@ -0,0 +1,35 @@
|
||||
@layout("/common/_container.html"){
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<div class="form-horizontal">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6 b-r">
|
||||
<#input id="passId" name="密钥UUID" underline="true"/>
|
||||
<#input id="passName" name="密钥名称" underline="true"/>
|
||||
<#input id="passLength" name="密钥长度" underline="true"/>
|
||||
<#input id="passType" name="密钥类型" underline="true"/>
|
||||
<#input id="passChildfir" name="第一子密钥"/>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<#input id="passChildsec" name="第二子密钥" underline="true"/>
|
||||
<#input id="passChildthi" name="第三子密钥" underline="true"/>
|
||||
<#input id="passExpiry" name="密钥有效期" underline="true"/>
|
||||
<#input id="passCreatetime" name="密钥上传时间" underline="true"/>
|
||||
<#input id="passUserid" name="密钥用户" underline="true"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row btn-group-m-t">
|
||||
<div class="col-sm-10">
|
||||
<#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="PassInstantInfoDlg.addSubmit()"/>
|
||||
<#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="PassInstantInfoDlg.close()"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script src="${ctxPath}/static/modular/PassInstant/passInstant/passInstant_info.js"></script>
|
||||
@}
|
||||
@ -0,0 +1,35 @@
|
||||
@layout("/common/_container.html"){
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<div class="form-horizontal">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6 b-r">
|
||||
<#input id="passId" name="密钥UUID" value="${item.passId}" underline="true"/>
|
||||
<#input id="passName" name="密钥名称" value="${item.passName}" underline="true"/>
|
||||
<#input id="passLength" name="密钥长度" value="${item.passLength}" underline="true"/>
|
||||
<#input id="passType" name="密钥类型" value="${item.passType}" underline="true"/>
|
||||
<#input id="passChildfir" name="第一子密钥" value="${item.passChildfir}" />
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<#input id="passChildsec" name="第二子密钥" value="${item.passChildsec}" underline="true"/>
|
||||
<#input id="passChildthi" name="第三子密钥" value="${item.passChildthi}" underline="true"/>
|
||||
<#input id="passExpiry" name="密钥有效期" value="${item.passExpiry}" underline="true"/>
|
||||
<#input id="passCreatetime" name="密钥上传时间" value="${item.passCreatetime}" underline="true"/>
|
||||
<#input id="passUserid" name="密钥用户" value="${item.passUserid}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row btn-group-m-t">
|
||||
<div class="col-sm-10">
|
||||
<#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="PassInstantInfoDlg.editSubmit()"/>
|
||||
<#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="PassInstantInfoDlg.close()"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script src="${ctxPath}/static/modular/PassInstant/passInstant/passInstant_info.js"></script>
|
||||
@}
|
||||
@ -0,0 +1,587 @@
|
||||
/*!
|
||||
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
||||
* Copyright 2011-2016 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
*/
|
||||
.btn-default,
|
||||
.btn-primary,
|
||||
.btn-success,
|
||||
.btn-info,
|
||||
.btn-warning,
|
||||
.btn-danger {
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
|
||||
}
|
||||
.btn-default:active,
|
||||
.btn-primary:active,
|
||||
.btn-success:active,
|
||||
.btn-info:active,
|
||||
.btn-warning:active,
|
||||
.btn-danger:active,
|
||||
.btn-default.active,
|
||||
.btn-primary.active,
|
||||
.btn-success.active,
|
||||
.btn-info.active,
|
||||
.btn-warning.active,
|
||||
.btn-danger.active {
|
||||
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
|
||||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
|
||||
}
|
||||
.btn-default.disabled,
|
||||
.btn-primary.disabled,
|
||||
.btn-success.disabled,
|
||||
.btn-info.disabled,
|
||||
.btn-warning.disabled,
|
||||
.btn-danger.disabled,
|
||||
.btn-default[disabled],
|
||||
.btn-primary[disabled],
|
||||
.btn-success[disabled],
|
||||
.btn-info[disabled],
|
||||
.btn-warning[disabled],
|
||||
.btn-danger[disabled],
|
||||
fieldset[disabled] .btn-default,
|
||||
fieldset[disabled] .btn-primary,
|
||||
fieldset[disabled] .btn-success,
|
||||
fieldset[disabled] .btn-info,
|
||||
fieldset[disabled] .btn-warning,
|
||||
fieldset[disabled] .btn-danger {
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.btn-default .badge,
|
||||
.btn-primary .badge,
|
||||
.btn-success .badge,
|
||||
.btn-info .badge,
|
||||
.btn-warning .badge,
|
||||
.btn-danger .badge {
|
||||
text-shadow: none;
|
||||
}
|
||||
.btn:active,
|
||||
.btn.active {
|
||||
background-image: none;
|
||||
}
|
||||
.btn-default {
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
|
||||
background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
|
||||
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #dbdbdb;
|
||||
border-color: #ccc;
|
||||
}
|
||||
.btn-default:hover,
|
||||
.btn-default:focus {
|
||||
background-color: #e0e0e0;
|
||||
background-position: 0 -15px;
|
||||
}
|
||||
.btn-default:active,
|
||||
.btn-default.active {
|
||||
background-color: #e0e0e0;
|
||||
border-color: #dbdbdb;
|
||||
}
|
||||
.btn-default.disabled,
|
||||
.btn-default[disabled],
|
||||
fieldset[disabled] .btn-default,
|
||||
.btn-default.disabled:hover,
|
||||
.btn-default[disabled]:hover,
|
||||
fieldset[disabled] .btn-default:hover,
|
||||
.btn-default.disabled:focus,
|
||||
.btn-default[disabled]:focus,
|
||||
fieldset[disabled] .btn-default:focus,
|
||||
.btn-default.disabled.focus,
|
||||
.btn-default[disabled].focus,
|
||||
fieldset[disabled] .btn-default.focus,
|
||||
.btn-default.disabled:active,
|
||||
.btn-default[disabled]:active,
|
||||
fieldset[disabled] .btn-default:active,
|
||||
.btn-default.disabled.active,
|
||||
.btn-default[disabled].active,
|
||||
fieldset[disabled] .btn-default.active {
|
||||
background-color: #e0e0e0;
|
||||
background-image: none;
|
||||
}
|
||||
.btn-primary {
|
||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%);
|
||||
background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88));
|
||||
background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #245580;
|
||||
}
|
||||
.btn-primary:hover,
|
||||
.btn-primary:focus {
|
||||
background-color: #265a88;
|
||||
background-position: 0 -15px;
|
||||
}
|
||||
.btn-primary:active,
|
||||
.btn-primary.active {
|
||||
background-color: #265a88;
|
||||
border-color: #245580;
|
||||
}
|
||||
.btn-primary.disabled,
|
||||
.btn-primary[disabled],
|
||||
fieldset[disabled] .btn-primary,
|
||||
.btn-primary.disabled:hover,
|
||||
.btn-primary[disabled]:hover,
|
||||
fieldset[disabled] .btn-primary:hover,
|
||||
.btn-primary.disabled:focus,
|
||||
.btn-primary[disabled]:focus,
|
||||
fieldset[disabled] .btn-primary:focus,
|
||||
.btn-primary.disabled.focus,
|
||||
.btn-primary[disabled].focus,
|
||||
fieldset[disabled] .btn-primary.focus,
|
||||
.btn-primary.disabled:active,
|
||||
.btn-primary[disabled]:active,
|
||||
fieldset[disabled] .btn-primary:active,
|
||||
.btn-primary.disabled.active,
|
||||
.btn-primary[disabled].active,
|
||||
fieldset[disabled] .btn-primary.active {
|
||||
background-color: #265a88;
|
||||
background-image: none;
|
||||
}
|
||||
.btn-success {
|
||||
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
|
||||
background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
|
||||
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #3e8f3e;
|
||||
}
|
||||
.btn-success:hover,
|
||||
.btn-success:focus {
|
||||
background-color: #419641;
|
||||
background-position: 0 -15px;
|
||||
}
|
||||
.btn-success:active,
|
||||
.btn-success.active {
|
||||
background-color: #419641;
|
||||
border-color: #3e8f3e;
|
||||
}
|
||||
.btn-success.disabled,
|
||||
.btn-success[disabled],
|
||||
fieldset[disabled] .btn-success,
|
||||
.btn-success.disabled:hover,
|
||||
.btn-success[disabled]:hover,
|
||||
fieldset[disabled] .btn-success:hover,
|
||||
.btn-success.disabled:focus,
|
||||
.btn-success[disabled]:focus,
|
||||
fieldset[disabled] .btn-success:focus,
|
||||
.btn-success.disabled.focus,
|
||||
.btn-success[disabled].focus,
|
||||
fieldset[disabled] .btn-success.focus,
|
||||
.btn-success.disabled:active,
|
||||
.btn-success[disabled]:active,
|
||||
fieldset[disabled] .btn-success:active,
|
||||
.btn-success.disabled.active,
|
||||
.btn-success[disabled].active,
|
||||
fieldset[disabled] .btn-success.active {
|
||||
background-color: #419641;
|
||||
background-image: none;
|
||||
}
|
||||
.btn-info {
|
||||
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
|
||||
background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
|
||||
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #28a4c9;
|
||||
}
|
||||
.btn-info:hover,
|
||||
.btn-info:focus {
|
||||
background-color: #2aabd2;
|
||||
background-position: 0 -15px;
|
||||
}
|
||||
.btn-info:active,
|
||||
.btn-info.active {
|
||||
background-color: #2aabd2;
|
||||
border-color: #28a4c9;
|
||||
}
|
||||
.btn-info.disabled,
|
||||
.btn-info[disabled],
|
||||
fieldset[disabled] .btn-info,
|
||||
.btn-info.disabled:hover,
|
||||
.btn-info[disabled]:hover,
|
||||
fieldset[disabled] .btn-info:hover,
|
||||
.btn-info.disabled:focus,
|
||||
.btn-info[disabled]:focus,
|
||||
fieldset[disabled] .btn-info:focus,
|
||||
.btn-info.disabled.focus,
|
||||
.btn-info[disabled].focus,
|
||||
fieldset[disabled] .btn-info.focus,
|
||||
.btn-info.disabled:active,
|
||||
.btn-info[disabled]:active,
|
||||
fieldset[disabled] .btn-info:active,
|
||||
.btn-info.disabled.active,
|
||||
.btn-info[disabled].active,
|
||||
fieldset[disabled] .btn-info.active {
|
||||
background-color: #2aabd2;
|
||||
background-image: none;
|
||||
}
|
||||
.btn-warning {
|
||||
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
|
||||
background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
|
||||
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #e38d13;
|
||||
}
|
||||
.btn-warning:hover,
|
||||
.btn-warning:focus {
|
||||
background-color: #eb9316;
|
||||
background-position: 0 -15px;
|
||||
}
|
||||
.btn-warning:active,
|
||||
.btn-warning.active {
|
||||
background-color: #eb9316;
|
||||
border-color: #e38d13;
|
||||
}
|
||||
.btn-warning.disabled,
|
||||
.btn-warning[disabled],
|
||||
fieldset[disabled] .btn-warning,
|
||||
.btn-warning.disabled:hover,
|
||||
.btn-warning[disabled]:hover,
|
||||
fieldset[disabled] .btn-warning:hover,
|
||||
.btn-warning.disabled:focus,
|
||||
.btn-warning[disabled]:focus,
|
||||
fieldset[disabled] .btn-warning:focus,
|
||||
.btn-warning.disabled.focus,
|
||||
.btn-warning[disabled].focus,
|
||||
fieldset[disabled] .btn-warning.focus,
|
||||
.btn-warning.disabled:active,
|
||||
.btn-warning[disabled]:active,
|
||||
fieldset[disabled] .btn-warning:active,
|
||||
.btn-warning.disabled.active,
|
||||
.btn-warning[disabled].active,
|
||||
fieldset[disabled] .btn-warning.active {
|
||||
background-color: #eb9316;
|
||||
background-image: none;
|
||||
}
|
||||
.btn-danger {
|
||||
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
|
||||
background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
|
||||
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #b92c28;
|
||||
}
|
||||
.btn-danger:hover,
|
||||
.btn-danger:focus {
|
||||
background-color: #c12e2a;
|
||||
background-position: 0 -15px;
|
||||
}
|
||||
.btn-danger:active,
|
||||
.btn-danger.active {
|
||||
background-color: #c12e2a;
|
||||
border-color: #b92c28;
|
||||
}
|
||||
.btn-danger.disabled,
|
||||
.btn-danger[disabled],
|
||||
fieldset[disabled] .btn-danger,
|
||||
.btn-danger.disabled:hover,
|
||||
.btn-danger[disabled]:hover,
|
||||
fieldset[disabled] .btn-danger:hover,
|
||||
.btn-danger.disabled:focus,
|
||||
.btn-danger[disabled]:focus,
|
||||
fieldset[disabled] .btn-danger:focus,
|
||||
.btn-danger.disabled.focus,
|
||||
.btn-danger[disabled].focus,
|
||||
fieldset[disabled] .btn-danger.focus,
|
||||
.btn-danger.disabled:active,
|
||||
.btn-danger[disabled]:active,
|
||||
fieldset[disabled] .btn-danger:active,
|
||||
.btn-danger.disabled.active,
|
||||
.btn-danger[disabled].active,
|
||||
fieldset[disabled] .btn-danger.active {
|
||||
background-color: #c12e2a;
|
||||
background-image: none;
|
||||
}
|
||||
.thumbnail,
|
||||
.img-thumbnail {
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
|
||||
}
|
||||
.dropdown-menu > li > a:hover,
|
||||
.dropdown-menu > li > a:focus {
|
||||
background-color: #e8e8e8;
|
||||
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
||||
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
|
||||
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.dropdown-menu > .active > a,
|
||||
.dropdown-menu > .active > a:hover,
|
||||
.dropdown-menu > .active > a:focus {
|
||||
background-color: #2e6da4;
|
||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
||||
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
|
||||
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.navbar-default {
|
||||
background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
|
||||
background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8));
|
||||
background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
background-repeat: repeat-x;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
|
||||
}
|
||||
.navbar-default .navbar-nav > .open > a,
|
||||
.navbar-default .navbar-nav > .active > a {
|
||||
background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
|
||||
background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
|
||||
background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
|
||||
}
|
||||
.navbar-brand,
|
||||
.navbar-nav > li > a {
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
|
||||
}
|
||||
.navbar-inverse {
|
||||
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
|
||||
background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
|
||||
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
background-repeat: repeat-x;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.navbar-inverse .navbar-nav > .open > a,
|
||||
.navbar-inverse .navbar-nav > .active > a {
|
||||
background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
|
||||
background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
|
||||
background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
|
||||
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
|
||||
}
|
||||
.navbar-inverse .navbar-brand,
|
||||
.navbar-inverse .navbar-nav > li > a {
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
|
||||
}
|
||||
.navbar-static-top,
|
||||
.navbar-fixed-top,
|
||||
.navbar-fixed-bottom {
|
||||
border-radius: 0;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.navbar .navbar-nav .open .dropdown-menu > .active > a,
|
||||
.navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
|
||||
.navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
|
||||
color: #fff;
|
||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
||||
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
|
||||
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
}
|
||||
.alert {
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
|
||||
}
|
||||
.alert-success {
|
||||
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
|
||||
background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
|
||||
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #b2dba1;
|
||||
}
|
||||
.alert-info {
|
||||
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
|
||||
background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
|
||||
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #9acfea;
|
||||
}
|
||||
.alert-warning {
|
||||
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
|
||||
background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
|
||||
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #f5e79e;
|
||||
}
|
||||
.alert-danger {
|
||||
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
|
||||
background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
|
||||
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #dca7a7;
|
||||
}
|
||||
.progress {
|
||||
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
|
||||
background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
|
||||
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.progress-bar {
|
||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%);
|
||||
background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090));
|
||||
background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.progress-bar-success {
|
||||
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
|
||||
background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
|
||||
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.progress-bar-info {
|
||||
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
|
||||
background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
|
||||
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.progress-bar-warning {
|
||||
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
|
||||
background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
|
||||
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.progress-bar-danger {
|
||||
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
|
||||
background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
|
||||
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.progress-bar-striped {
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
.list-group {
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
|
||||
}
|
||||
.list-group-item.active,
|
||||
.list-group-item.active:hover,
|
||||
.list-group-item.active:focus {
|
||||
text-shadow: 0 -1px 0 #286090;
|
||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%);
|
||||
background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a));
|
||||
background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #2b669a;
|
||||
}
|
||||
.list-group-item.active .badge,
|
||||
.list-group-item.active:hover .badge,
|
||||
.list-group-item.active:focus .badge {
|
||||
text-shadow: none;
|
||||
}
|
||||
.panel {
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
|
||||
}
|
||||
.panel-default > .panel-heading {
|
||||
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
||||
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
|
||||
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.panel-primary > .panel-heading {
|
||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
||||
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
|
||||
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.panel-success > .panel-heading {
|
||||
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
|
||||
background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
|
||||
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.panel-info > .panel-heading {
|
||||
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
|
||||
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
|
||||
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.panel-warning > .panel-heading {
|
||||
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
|
||||
background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
|
||||
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.panel-danger > .panel-heading {
|
||||
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
|
||||
background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
|
||||
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.well {
|
||||
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
|
||||
background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
|
||||
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
|
||||
background-repeat: repeat-x;
|
||||
border-color: #dcdcdc;
|
||||
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
|
||||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap-theme.css.map */
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue