@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
|
||||
<fileset name="all" enabled="true" check-config-name="checkstyle-rules" local="false">
|
||||
<file-match-pattern match-pattern="." include-pattern="true"/>
|
||||
</fileset>
|
||||
</fileset-config>
|
||||
@ -0,0 +1 @@
|
||||
*.html linguist-language=java
|
||||
@ -0,0 +1,4 @@
|
||||
[submodule "summer-ospp/2023/shenyu"]
|
||||
url = https://gitee.com/dromara/MaxKey
|
||||
path = summer-ospp/2023/shenyu
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
第三方许可证/Third party licenses
|
||||
|
||||
see
|
||||
https://maxkey.top/zh/about/dependency.html
|
||||
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* MaxKey build file was auto generated by running the Gradle release.bat
|
||||
*/
|
||||
|
||||
defaultTasks "clearBuild"
|
||||
|
||||
//Version define
|
||||
ext {
|
||||
|
||||
}
|
||||
|
||||
task clearBuild(){
|
||||
println 'Clear Build MaxKey ... '
|
||||
delete "$rootDir/build.gradle"
|
||||
delete "$rootDir/maxkey-webs/maxkey-web-mgt/build.gradle"
|
||||
delete "$rootDir/maxkey-webs/maxkey-web-maxkey/build.gradle"
|
||||
delete "$rootDir/maxkey-webs/maxkey-web-openapi/build.gradle"
|
||||
}
|
||||
|
||||
task configStd(dependsOn:['clearBuild']) {
|
||||
doLast {
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-openapi/config/build_standard.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-openapi/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-mgt/config/build_standard.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-mgt/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-maxkey/config/build_standard.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-maxkey/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
copy {
|
||||
from "$rootDir/config/build_standard.gradle"
|
||||
into "$rootDir/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
|
||||
println 'Standard Build MaxKey .'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
task configDocker(dependsOn:['clearBuild']) {
|
||||
doLast {
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-openapi/config/build_docker.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-openapi/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-mgt/config/build_docker.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-mgt/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-maxkey/config/build_docker.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-maxkey/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
|
||||
copy {
|
||||
from "$rootDir/config/build_docker.gradle"
|
||||
into "$rootDir/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
|
||||
println 'Docker Build MaxKey .'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
task configJar(dependsOn:['clearBuild']) {
|
||||
doLast {
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-openapi/config/build_jar.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-openapi/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-mgt/config/build_jar.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-mgt/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
|
||||
copy {
|
||||
from "$rootDir/maxkey-webs/maxkey-web-maxkey/config/build_jar.gradle"
|
||||
into "$rootDir/maxkey-webs/maxkey-web-maxkey/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
|
||||
copy {
|
||||
from "$rootDir/config/build_jar.gradle"
|
||||
into "$rootDir/"
|
||||
rename { String fileName -> 'build.gradle' }
|
||||
}
|
||||
|
||||
println 'Java Jar Build MaxKey .'
|
||||
}
|
||||
}
|
||||
|
||||
// In this section you declare the dependencies for your production and test code
|
||||
dependencies {
|
||||
|
||||
}
|
||||
@ -0,0 +1,324 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
|
||||
<!--
|
||||
Checkstyle configuration that checks the Google coding conventions from Google Java Style
|
||||
that can be found at https://google.github.io/styleguide/javaguide.html
|
||||
Checkstyle is very configurable. Be sure to read the documentation at
|
||||
http://checkstyle.org (or in your downloaded distribution).
|
||||
To completely disable a check, just comment it out or delete it from the file.
|
||||
To suppress certain violations please review suppression filters.
|
||||
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
|
||||
-->
|
||||
|
||||
<module name = "Checker">
|
||||
<property name="charset" value="UTF-8"/>
|
||||
|
||||
<property name="severity" value="warning"/>
|
||||
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
<!-- Excludes all 'module-info.java' files -->
|
||||
<!-- See https://checkstyle.org/config_filefilters.html -->
|
||||
<module name="BeforeExecutionExclusionFileFilter">
|
||||
<property name="fileNamePattern" value="module\-info\.java$"/>
|
||||
</module>
|
||||
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
|
||||
default="checkstyle-suppressions.xml" />
|
||||
<property name="optional" value="true"/>
|
||||
</module>
|
||||
|
||||
<!-- Checks for whitespace -->
|
||||
<!-- See http://checkstyle.org/config_whitespace.html -->
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="LineLength">
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="max" value="100"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="IllegalTokenText">
|
||||
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
|
||||
<property name="format"
|
||||
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
||||
<property name="message"
|
||||
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
|
||||
</module>
|
||||
<module name="AvoidEscapedUnicodeCharacters">
|
||||
<property name="allowEscapesForControlCharacters" value="true"/>
|
||||
<property name="allowByTailComment" value="true"/>
|
||||
<property name="allowNonPrintableEscapes" value="true"/>
|
||||
</module>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="NoLineWrap">
|
||||
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/>
|
||||
</module>
|
||||
<module name="EmptyBlock">
|
||||
<property name="option" value="TEXT"/>
|
||||
<property name="tokens"
|
||||
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
||||
</module>
|
||||
<module name="NeedBraces">
|
||||
<property name="tokens"
|
||||
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/>
|
||||
</module>
|
||||
<module name="LeftCurly">
|
||||
<property name="tokens"
|
||||
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
|
||||
INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
|
||||
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
|
||||
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
|
||||
OBJBLOCK, STATIC_INIT"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlySame"/>
|
||||
<property name="tokens"
|
||||
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
|
||||
LITERAL_DO"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlyAlone"/>
|
||||
<property name="option" value="alone"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
|
||||
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF"/>
|
||||
</module>
|
||||
<module name="SuppressionXpathSingleFilter">
|
||||
<!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
|
||||
<property name="id" value="RightCurlyAlone"/>
|
||||
<property name="query" value="//RCURLY[parent::SLIST[count(./*)=1]
|
||||
or preceding-sibling::*[last()][self::LCURLY]]"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="allowEmptyConstructors" value="true"/>
|
||||
<property name="allowEmptyLambdas" value="true"/>
|
||||
<property name="allowEmptyMethods" value="true"/>
|
||||
<property name="allowEmptyTypes" value="true"/>
|
||||
<property name="allowEmptyLoops" value="true"/>
|
||||
<property name="tokens"
|
||||
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
|
||||
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
|
||||
LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
|
||||
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
|
||||
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
|
||||
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
|
||||
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
|
||||
<message key="ws.notFollowed"
|
||||
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
|
||||
<message key="ws.notPreceded"
|
||||
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="OneStatementPerLine"/>
|
||||
<module name="MultipleVariableDeclarations"/>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="FallThrough"/>
|
||||
<module name="UpperEll"/>
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="EmptyLineSeparator">
|
||||
<property name="tokens"
|
||||
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
|
||||
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapDot"/>
|
||||
<property name="tokens" value="DOT"/>
|
||||
<property name="option" value="nl"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapComma"/>
|
||||
<property name="tokens" value="COMMA"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
|
||||
<property name="id" value="SeparatorWrapEllipsis"/>
|
||||
<property name="tokens" value="ELLIPSIS"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
|
||||
<property name="id" value="SeparatorWrapArrayDeclarator"/>
|
||||
<property name="tokens" value="ARRAY_DECLARATOR"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapMethodRef"/>
|
||||
<property name="tokens" value="METHOD_REF"/>
|
||||
<property name="option" value="nl"/>
|
||||
</module>
|
||||
<module name="PackageName">
|
||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Package name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="TypeName">
|
||||
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LambdaParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="CatchParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LocalVariableName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ClassTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MethodTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="InterfaceTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="NoFinalizer"/>
|
||||
<module name="GenericWhitespace">
|
||||
<message key="ws.followed"
|
||||
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
|
||||
<message key="ws.preceded"
|
||||
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
|
||||
<message key="ws.illegalFollow"
|
||||
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
|
||||
<message key="ws.notPreceded"
|
||||
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="Indentation">
|
||||
<property name="basicOffset" value="4"/>
|
||||
<property name="braceAdjustment" value="0"/>
|
||||
<property name="caseIndent" value="4"/>
|
||||
<property name="throwsIndent" value="8"/>
|
||||
<property name="lineWrappingIndentation" value="8"/>
|
||||
<property name="arrayInitIndent" value="4"/>
|
||||
</module>
|
||||
<module name="AbbreviationAsWordInName">
|
||||
<property name="ignoreFinal" value="false"/>
|
||||
<property name="allowedAbbreviationLength" value="1"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
|
||||
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF"/>
|
||||
</module>
|
||||
<module name="OverloadMethodsDeclarationOrder"/>
|
||||
<module name="VariableDeclarationUsageDistance"/>
|
||||
<module name="CustomImportOrder">
|
||||
<property name="sortImportsInGroupAlphabetically" value="true"/>
|
||||
<property name="separateLineBetweenGroups" value="true"/>
|
||||
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
|
||||
<property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF"/>
|
||||
</module>
|
||||
<module name="MethodParamPad">
|
||||
<property name="tokens"
|
||||
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
|
||||
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceBefore">
|
||||
<property name="tokens"
|
||||
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
|
||||
<property name="allowLineBreaks" value="true"/>
|
||||
</module>
|
||||
<module name="ParenPad">
|
||||
<property name="tokens"
|
||||
value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF,
|
||||
EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW,
|
||||
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
|
||||
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA"/>
|
||||
</module>
|
||||
<module name="OperatorWrap">
|
||||
<property name="option" value="NL"/>
|
||||
<property name="tokens"
|
||||
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
|
||||
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="id" value="AnnotationLocationMostCases"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="id" value="AnnotationLocationVariables"/>
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
</module>
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
<module name="InvalidJavadocPosition"/>
|
||||
<module name="JavadocTagContinuationIndentation"/>
|
||||
<module name="SummaryJavadoc">
|
||||
<property name="forbiddenSummaryFragments"
|
||||
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
|
||||
</module>
|
||||
<module name="JavadocParagraph"/>
|
||||
<module name="AtclauseOrder">
|
||||
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
|
||||
<property name="target"
|
||||
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope" value="public"/>
|
||||
<property name="allowMissingParamTags" value="true"/>
|
||||
<property name="allowMissingReturnTag" value="true"/>
|
||||
<property name="allowedAnnotations" value="Override, Test"/>
|
||||
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
|
||||
</module>
|
||||
<module name="MissingJavadocMethod">
|
||||
<property name="scope" value="public"/>
|
||||
<property name="minLineCount" value="2"/>
|
||||
<property name="allowedAnnotations" value="Override, Test"/>
|
||||
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="SingleLineJavadoc">
|
||||
<property name="ignoreInlineTags" value="false"/>
|
||||
</module>
|
||||
<module name="EmptyCatchBlock">
|
||||
<property name="exceptionVariableName" value="expected"/>
|
||||
</module>
|
||||
<module name="CommentsIndentation">
|
||||
<property name="tokens" value="SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN"/>
|
||||
</module>
|
||||
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
|
||||
<module name="SuppressionXpathFilter">
|
||||
<property name="file" value="${org.checkstyle.google.suppressionxpathfilter.config}"
|
||||
default="checkstyle-xpath-suppressions.xml" />
|
||||
<property name="optional" value="true"/>
|
||||
</module>
|
||||
</module>
|
||||
</module>
|
||||
@ -0,0 +1,87 @@
|
||||
version: '3'
|
||||
|
||||
networks:
|
||||
maxkey.top:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0.32
|
||||
container_name: maxkey-mysql
|
||||
hostname: maxkey-mysql
|
||||
volumes:
|
||||
- ./docker-mysql/data:/var/lib/mysql
|
||||
- ./docker-mysql/logs:/var/log/mysql
|
||||
- ./docker-mysql/conf.d:/etc/mysql/conf.d
|
||||
- ./docker-mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=maxkey
|
||||
ports:
|
||||
- "3306:3306"
|
||||
restart: always
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
networks:
|
||||
- maxkey.top
|
||||
|
||||
maxkey-frontend:
|
||||
image: maxkeytop/maxkey-frontend:latest
|
||||
container_name: maxkey-frontend
|
||||
hostname: maxkey-frontend
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- "8527:8527"
|
||||
networks:
|
||||
- maxkey.top
|
||||
|
||||
maxkey:
|
||||
image: maxkeytop/maxkey:latest
|
||||
container_name: maxkey
|
||||
hostname: maxkey
|
||||
environment:
|
||||
- DATABASE_HOST=maxkey-mysql
|
||||
- DATABASE_PORT=3306
|
||||
- DATABASE_NAME=maxkey
|
||||
- DATABASE_USER=root
|
||||
- DATABASE_PWD=maxkey
|
||||
ports:
|
||||
- "9527:9527"
|
||||
networks:
|
||||
- maxkey.top
|
||||
|
||||
maxkey-mgt:
|
||||
image: maxkeytop/maxkey-mgt:latest
|
||||
container_name: maxkey-mgt
|
||||
hostname: maxkey-mgt
|
||||
environment:
|
||||
- DATABASE_HOST=maxkey-mysql
|
||||
- DATABASE_PORT=3306
|
||||
- DATABASE_NAME=maxkey
|
||||
- DATABASE_USER=root
|
||||
- DATABASE_PWD=maxkey
|
||||
ports:
|
||||
- "9526:9526"
|
||||
networks:
|
||||
- maxkey.top
|
||||
|
||||
maxkey-mgt-frontend:
|
||||
image: maxkeytop/maxkey-mgt-frontend:latest
|
||||
container_name: maxkey-mgt-frontend
|
||||
hostname: maxkey-mgt-frontend
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- "8526:8526"
|
||||
networks:
|
||||
- maxkey.top
|
||||
|
||||
maxkey-nginx:
|
||||
image: nginx:latest
|
||||
container_name: maxkey-nginx
|
||||
hostname: maxkey-nginx
|
||||
volumes:
|
||||
- ./docker-nginx:/etc/nginx/conf.d
|
||||
ports:
|
||||
- "80:80"
|
||||
networks:
|
||||
- maxkey.top
|
||||
@ -0,0 +1,39 @@
|
||||
# Percona Server template configuration
|
||||
|
||||
[mysqld]
|
||||
#
|
||||
# Remove leading # and set to the amount of RAM for the most important data
|
||||
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
|
||||
# innodb_buffer_pool_size = 128M
|
||||
#
|
||||
# Remove leading # to turn on a very important data integrity option: logging
|
||||
# changes to the binary log between backups.
|
||||
# log_bin
|
||||
#
|
||||
# Remove leading # to set options mainly useful for reporting servers.
|
||||
# The server defaults are faster for transactions and fast SELECTs.
|
||||
# Adjust sizes as needed, experiment to find the optimal values.
|
||||
# join_buffer_size = 128M
|
||||
# sort_buffer_size = 2M
|
||||
# read_rnd_buffer_size = 2M
|
||||
datadir=/var/lib/mysql
|
||||
socket=/var/lib/mysql/mysql.sock
|
||||
|
||||
character-set-server=utf8
|
||||
lower_case_table_names=1
|
||||
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
symbolic-links=0
|
||||
|
||||
log-error=/var/lib/mysql/error.log
|
||||
slow_query_log=on;
|
||||
slow-query-log-file=/var/lib/mysql/mysql-slow.log
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
|
||||
sql_mode = STRICT_ALL_TABLES,NO_ENGINE_SUBSTITUTION
|
||||
|
||||
[mysql]
|
||||
default-character-set=utf8
|
||||
|
||||
[client]
|
||||
default-character-set=utf8
|
||||
@ -0,0 +1,7 @@
|
||||
create database if not exists `maxkey` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ ;
|
||||
|
||||
use maxkey ;
|
||||
|
||||
source /docker-entrypoint-initdb.d/latest/maxkey.sql ;
|
||||
source /docker-entrypoint-initdb.d/latest/maxkey_data.sql ;
|
||||
|
||||
@ -0,0 +1 @@
|
||||
v 4.0.1 GA
|
||||
@ -0,0 +1,9 @@
|
||||
#MaxKey nginx Proxy Docker Build
|
||||
|
||||
FROM nginx
|
||||
|
||||
COPY ./default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
|
||||
#CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
#MaxKey nginx Proxy Server
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_name localhost;
|
||||
|
||||
proxy_set_header host $host; # 转发请求时将请求的域名一起转发
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
#服务器集群路径
|
||||
#认证后端
|
||||
location /sign/ {
|
||||
proxy_pass http://maxkey:9527/sign/;
|
||||
}
|
||||
|
||||
#认证前端
|
||||
location /maxkey/ {
|
||||
proxy_pass http://maxkey-frontend:8527/maxkey/;
|
||||
}
|
||||
|
||||
#管理后端
|
||||
location /maxkey-mgt-api/ {
|
||||
proxy_pass http://maxkey-mgt:9526/maxkey-mgt-api/;
|
||||
}
|
||||
|
||||
#管理前端
|
||||
location /maxkey-mgt/ {
|
||||
proxy_pass http://maxkey-mgt-frontend:8526/maxkey-mgt/;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
echo "clear REPOSITORY IMAGE MaxKey ... "
|
||||
|
||||
#maxkey-nginx proxy
|
||||
docker rmi maxkeytop/maxkey-nginx
|
||||
|
||||
#maxkey-frontend
|
||||
docker rmi maxkeytop/maxkey-frontend
|
||||
|
||||
#maxkey-mgt-frontend
|
||||
docker rmi maxkeytop/maxkey-mgt-frontend
|
||||
|
||||
#maxkey
|
||||
docker rmi maxkeytop/maxkey
|
||||
|
||||
#maxkey-mgt
|
||||
docker rmi maxkeytop/maxkey-mgt
|
||||
|
||||
#MySQL
|
||||
docker rmi maxkeytop/mysql
|
||||
|
||||
echo "clear REPOSITORY IMAGE done."
|
||||
@ -0,0 +1,29 @@
|
||||
echo "network create "
|
||||
|
||||
docker network create maxkey.top
|
||||
|
||||
mysql_version=8.0.32
|
||||
#MySQL
|
||||
docker pull mysql:$mysql_version
|
||||
docker image tag mysql:$mysql_version maxkeytop/mysql
|
||||
|
||||
#maxkey
|
||||
docker pull maxkeytop/maxkey:latest
|
||||
|
||||
#maxkey-mgt
|
||||
docker pull maxkeytop/maxkey-mgt:latest
|
||||
|
||||
#maxkey-frontend
|
||||
docker pull maxkeytop/maxkey-frontend:latest
|
||||
|
||||
#maxkey-mgt-frontend
|
||||
docker pull maxkeytop/maxkey-mgt-frontend:latest
|
||||
|
||||
#maxkey-nginx proxy
|
||||
cd docker-nginx
|
||||
|
||||
docker build -f Dockerfile -t maxkeytop/maxkey-nginx .
|
||||
|
||||
cd ..
|
||||
|
||||
echo "installed done."
|
||||
@ -0,0 +1,23 @@
|
||||
echo "rm MaxKey ... "
|
||||
|
||||
./maxkey_docker_stop.sh
|
||||
|
||||
#maxkey-nginx proxy
|
||||
docker rm maxkey-nginx
|
||||
|
||||
#maxkey-frontend
|
||||
docker rm maxkey-frontend
|
||||
|
||||
#maxkey-mgt-frontend
|
||||
docker rm maxkey-mgt-frontend
|
||||
|
||||
#maxkey
|
||||
docker rm maxkey
|
||||
|
||||
#maxkey-mgt
|
||||
docker rm maxkey-mgt
|
||||
|
||||
#MySQL
|
||||
docker rm maxkey-mysql
|
||||
|
||||
echo "rm done."
|
||||
@ -0,0 +1,61 @@
|
||||
echo "start MaxKey ... "
|
||||
#MySQL
|
||||
docker run -p 3306:3306 \
|
||||
-v ./docker-mysql/data:/var/lib/mysql \
|
||||
-v ./docker-mysql/logs:/var/log/mysql \
|
||||
-v ./docker-mysql/conf.d:/etc/mysql/conf.d \
|
||||
-v ./docker-mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d \
|
||||
--name maxkey-mysql \
|
||||
--hostname maxkey-mysql \
|
||||
--network maxkey.top \
|
||||
-e MYSQL_ROOT_PASSWORD=maxkey \
|
||||
-d maxkeytop/mysql:latest
|
||||
|
||||
#maxkey
|
||||
docker run -p 9527:9527 \
|
||||
-e DATABASE_HOST=maxkey-mysql \
|
||||
-e DATABASE_PORT=3306 \
|
||||
-e DATABASE_NAME=maxkey \
|
||||
-e DATABASE_USER=root \
|
||||
-e DATABASE_PWD=maxkey \
|
||||
--name maxkey \
|
||||
--hostname maxkey \
|
||||
--network maxkey.top \
|
||||
-d maxkeytop/maxkey:latest
|
||||
|
||||
#maxkey-mgt
|
||||
docker run -p 9526:9526 \
|
||||
-e DATABASE_HOST=maxkey-mysql \
|
||||
-e DATABASE_PORT=3306 \
|
||||
-e DATABASE_NAME=maxkey \
|
||||
-e DATABASE_USER=root \
|
||||
-e DATABASE_PWD=maxkey \
|
||||
--name maxkey-mgt \
|
||||
--hostname maxkey-mgt \
|
||||
--network maxkey.top \
|
||||
-d maxkeytop/maxkey-mgt:latest
|
||||
|
||||
#maxkey-frontend
|
||||
docker run -p 8527:8527 \
|
||||
--name maxkey-frontend \
|
||||
--hostname maxkey-frontend \
|
||||
--network maxkey.top \
|
||||
-d maxkeytop/maxkey-frontend:latest
|
||||
|
||||
#maxkey-mgt-frontend
|
||||
docker run -p 8526:8526 \
|
||||
--name maxkey-mgt-frontend \
|
||||
--hostname maxkey-mgt-frontend \
|
||||
--network maxkey.top \
|
||||
-d maxkeytop/maxkey-mgt-frontend:latest
|
||||
|
||||
#maxkey-nginx proxy
|
||||
docker run -p 80:80 \
|
||||
--name maxkey-nginx \
|
||||
--hostname maxkey-nginx \
|
||||
--network maxkey.top \
|
||||
-d maxkeytop/maxkey-nginx
|
||||
|
||||
docker ps -a
|
||||
|
||||
echo "started done."
|
||||
@ -0,0 +1,21 @@
|
||||
echo "stop MaxKey ... "
|
||||
|
||||
#maxkey-nginx proxy
|
||||
docker stop maxkey-nginx
|
||||
|
||||
#maxkey-frontend
|
||||
docker stop maxkey-frontend
|
||||
|
||||
#maxkey-mgt-frontend
|
||||
docker stop maxkey-mgt-frontend
|
||||
|
||||
#maxkey
|
||||
docker stop maxkey
|
||||
|
||||
#maxkey-mgt
|
||||
docker stop maxkey-mgt
|
||||
|
||||
#MySQL
|
||||
docker stop maxkey-mysql
|
||||
|
||||
echo "stoped done."
|
||||
@ -0,0 +1,207 @@
|
||||
#/*
|
||||
# * Copyright [2023] [MaxKey of copyright http://www.maxkey.top]
|
||||
# *
|
||||
# * 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
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing, software
|
||||
# * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# * See the License for the specific language governing permissions and
|
||||
# * limitations under the License.
|
||||
# */
|
||||
#maxkey properties
|
||||
group =org.dromara.maxkey
|
||||
version =4.0.2
|
||||
vendor =https://www.maxkey.top
|
||||
author =MaxKeyTop
|
||||
|
||||
#docker jib image
|
||||
jibFromImage =eclipse-temurin:17-jre
|
||||
jibToImage =maxkeytop
|
||||
jibToAuthUsername =maxkeytop
|
||||
jibToAuthPassword =docker registry credential
|
||||
|
||||
#maxkey used jars version
|
||||
#spring
|
||||
springVersion =6.0.17
|
||||
springBootVersion =3.1.8
|
||||
springSecurityVersion =6.1.6
|
||||
springDataVersion =3.0.3
|
||||
springkafkaVersion =3.0.13
|
||||
springretryVersion =1.3.3
|
||||
#spring plugin
|
||||
springplugincoreVersion =3.0.0
|
||||
springpluginmetadataVersion =3.0.0
|
||||
#spring cloud
|
||||
springcloudVersion =4.0.4
|
||||
#spring cloud alibaba
|
||||
springcloudalibabaVersion =2022.0.0.0
|
||||
springcloudalibabaspringVersion =1.0.11
|
||||
springcloudalibabacsplVersion =1.8.5
|
||||
alibabanacosclientVersion =2.2.3
|
||||
#Apache commons
|
||||
commonsbeanutilsVersion =1.9.4
|
||||
commonscodecVersion =1.15
|
||||
commonscollectionsVersion =3.2.2
|
||||
commonscollections4Version =4.4
|
||||
commonscompressVersion =1.21
|
||||
commonscsvVersion =1.7
|
||||
commonstextVersion =1.9
|
||||
commonsdbcp2Version =2.9.0
|
||||
commonsdbutilsVersion =1.7
|
||||
commonsdigester3Version =3.2
|
||||
commonsdigesterVersion =2.1
|
||||
commonsioVersion =2.8.0
|
||||
commonslangVersion =2.6
|
||||
commonslang3Version =3.12.0
|
||||
commonsloggingVersion =1.2
|
||||
commonspool2Version =2.11.1
|
||||
commonshttpclientVersion =3.1
|
||||
commonsfileuploadVersion =1.5
|
||||
commonsvalidatorVersion =1.7
|
||||
#Apache Http
|
||||
#v4
|
||||
httpcomponentsVersion =4.5.14
|
||||
httpcoreVersion =4.4.6
|
||||
httpasyncclientVersion =4.1.5
|
||||
#v5
|
||||
httpcomponentscore5Version =5.2.1
|
||||
#Libs
|
||||
velocityVersion =1.7
|
||||
velocitydepVersion =1.4
|
||||
freemarkerVersion =2.3.32
|
||||
xmlbeansVersion =5.0.2
|
||||
poiVersion =5.2.3
|
||||
#tomcat
|
||||
tomcatVersion =10.1.18
|
||||
#logs
|
||||
log4jVersion =2.22.1
|
||||
slf4jVersion =2.0.11
|
||||
jbossloggingVersion =3.5.0.Final
|
||||
#Messaging Kafka & RocketMQ
|
||||
kafkaclientsVersion =3.4.0
|
||||
rocketmqclientVersion =5.1.0
|
||||
rocketmqspringbootVersion =2.2.3
|
||||
#google
|
||||
jibGradlePluginVersion =3.3.2
|
||||
jhlabsfiltersVersion =2.0.235-1
|
||||
kaptchaVersion =2.3.2
|
||||
guavaVersion =31.1-jre
|
||||
tinkVersion =1.8.0
|
||||
zxingcoreVersion =3.5.1
|
||||
concurrentlinkedhashmaplruVersion =1.4.2
|
||||
#json
|
||||
gsonVersion =2.10.1
|
||||
jacksonVersion =2.16.1
|
||||
fastjsonVersion =1.2.83
|
||||
minidevjsonsmartVersion =2.4.5
|
||||
#database
|
||||
mysqlconnectorjavaVersion =8.0.32
|
||||
dm8JdbcDriverVersion =8.1.2.192
|
||||
postgresqlVersion =42.4.1
|
||||
druidVersion =1.2.16
|
||||
druidspringbootstarterVersion =1.2.16
|
||||
jedisVersion =4.3.2
|
||||
caffeineVersion =3.1.5
|
||||
hibernateVersion =7.0.5.Final
|
||||
mybatisVersion =3.5.15
|
||||
mybatisspringVersion =3.0.2
|
||||
mybatisjpaextraVersion =3.2
|
||||
#saml
|
||||
opensamlVersion =2.6.6
|
||||
openwsVersion =1.5.6
|
||||
xmltoolingVersion =1.4.6
|
||||
javasupportVersion =8.0.0
|
||||
#jakarta
|
||||
jakartaannotationVersion =2.1.1
|
||||
jakartaactivationVersion =2.1.1
|
||||
jakartamailapiVersion =2.1.1
|
||||
jakartapersistenceapiVersion =3.0.0
|
||||
jakartatransactionapiVersion =2.0.1
|
||||
jakartavalidationapiVersion =3.0.2
|
||||
jakartaxmlbindapiVersion =3.0.1
|
||||
#mail
|
||||
angusjakartamailVersion =2.0.1
|
||||
angusactivationVersion =2.0.0
|
||||
#xml
|
||||
xmlbindjaxbcoreVersion =3.0.2
|
||||
xmlbindjaxbimplVersion =3.0.2
|
||||
xmlbindjaxbxjcVersion =3.0.2
|
||||
#jwt
|
||||
nimbusjosejwtVersion =9.31
|
||||
jcipannotationsVersion =1.0-1
|
||||
#others
|
||||
thymeleafVersion =3.0.15.RELEASE
|
||||
nettyVersion =4.1.65.Final
|
||||
hazelcastVersion =4.2.2
|
||||
attoparserVersion =2.0.5.RELEASE
|
||||
unbescapeVersion =1.1.6.RELEASE
|
||||
woodstoxVersion =6.2.8
|
||||
bouncycastleVersion =1.71
|
||||
junitVersion =4.11
|
||||
xmlunitVersion =1.6
|
||||
mockitoallVersion =1.10.19
|
||||
minidevasmVersion =1.0.2
|
||||
javassistVersion =3.29.0-GA
|
||||
esapiVersion =2.2.0.0
|
||||
jtaVersion =1.1
|
||||
validationapiVersion =2.0.1.Final
|
||||
jsr173Version =1.0
|
||||
jaxbapiVersion =2.3.1
|
||||
classmateVersion =1.5.1
|
||||
reactivestreamsVersion =1.0.4
|
||||
reactorcoreVersion =3.5.3
|
||||
reactornettyVersion =1.1.4
|
||||
reactorextraVersion =3.5.0
|
||||
szxcvbnVersion =0.2
|
||||
nekohtmlVersion =1.9.22
|
||||
ognlVersion =3.3.3
|
||||
cglibVersion =3.3.0
|
||||
asmVersion =9.4
|
||||
aopallianceVersion =1.0
|
||||
aspectjtoolsVersion =1.9.9.1
|
||||
evictorVersion =1.0.0
|
||||
lettuceVersion =6.1.9.RELEASE
|
||||
reflectionsVersion =0.10.2
|
||||
#xml
|
||||
jdom2Version =2.0.6.1
|
||||
dom4jVersion =2.1.4
|
||||
serializerVersion =2.7.2
|
||||
xmlresolverVersion =1.2
|
||||
xmlsecVersion =2.1.7
|
||||
xpp3Version =1.1.6
|
||||
xstreamVersion =1.4.19
|
||||
passayVersion =1.6.2
|
||||
LatencyUtilsVersion =2.0.3
|
||||
stax2apiVersion =4.2.1
|
||||
#tools
|
||||
quartzVersion =2.3.2
|
||||
springbootadminVersion =2.7.3
|
||||
jodatimeVersion =2.12.2
|
||||
snakeyamlVersion =2.0
|
||||
ip2regionVersion =2.7.0
|
||||
maxminddbVersion =3.0.0
|
||||
maxmindgeoip2Version =4.0.1
|
||||
pinyin4jVersion =2.5.1
|
||||
jsoupVersion =1.15.4
|
||||
micrometercoreVersion =1.10.5
|
||||
prometheusVersion =0.16.0
|
||||
mapstructVersion =1.5.3.Final
|
||||
JustAuthVersion =1.16.5
|
||||
simplehttpVersion =1.0.5
|
||||
#doc
|
||||
swaggerV3Version =2.2.8
|
||||
classgraphVersion =4.8.149
|
||||
webjarslocatorcoreVersion =0.52
|
||||
webjarslocatorVersion =0.46
|
||||
swaggeruiVersion =4.18.1
|
||||
springdocVersion =2.0.2
|
||||
knife4jVersion =4.0.0
|
||||
#sdk
|
||||
aliyunjavasdkcoreVersion =4.6.4
|
||||
opentracingVersion =0.33.0
|
||||
tencentcloudsdkjavaVersion =3.1.33
|
||||
@ -0,0 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@ -0,0 +1,244 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original 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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
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
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem 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, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 308 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 204 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 226 KiB |
|
After Width: | Height: | Size: 57 KiB |
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@ -0,0 +1,61 @@
|
||||
<?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.3.1.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>net.maxsso</groupId>
|
||||
<artifactId>cas-springboot-demo</artifactId>
|
||||
<version>1.0</version>
|
||||
<name>cas-springboot-demo</name>
|
||||
<description>CAS Client Demo project for Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>sso.maxkey</groupId>-->
|
||||
<!-- <artifactId>maxkey-client-sdk</artifactId>-->
|
||||
<!-- <version>2.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/net.unicon.cas/cas-client-autoconfig-support -->
|
||||
<dependency>
|
||||
<groupId>net.unicon.cas</groupId>
|
||||
<artifactId>cas-client-autoconfig-support</artifactId>
|
||||
<version>2.3.0-GA</version>
|
||||
</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>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,15 @@
|
||||
package net.maxsso.cas.demo;
|
||||
|
||||
import net.unicon.cas.client.configuration.EnableCasClient;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableCasClient
|
||||
public class CasClientDemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CasClientDemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
server:
|
||||
port: 8989
|
||||
cas:
|
||||
server-url-prefix: http://sso.maxkey.top/sign/authz/cas/
|
||||
server-login-url: http://sso.maxkey.top/sign/authz/cas/login
|
||||
client-host-url: http://127.0.0.1:8989/
|
||||
validation-type: cas
|
||||
# 拦截的URL地址
|
||||
authentication-url-patterns:
|
||||
- /test1/index
|
||||
- /test1/index1
|
||||
@ -0,0 +1,13 @@
|
||||
|
||||
# JustAuth 源码地址
|
||||
https://github.com/justauth/JustAuth
|
||||
|
||||
# 文档地址
|
||||
|
||||
https://justauth.wiki/guide/quickstart/how-to-use
|
||||
|
||||
# 视频演示
|
||||
|
||||
https://b23.tv/8eZQCJD
|
||||
|
||||
【jeesite+ruoyi+ruoyi-vue plus+maxkey+JustAuth+oauthor2统一认证统一门户演示-哔哩哔哩】
|
||||
@ -0,0 +1,52 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.2.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>jeesite-module-maxkey</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>JeeSite Module maxkey</name>
|
||||
<url>http://jeesite.com</url>
|
||||
<inceptionYear>2013-Now</inceptionYear>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-module-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>1.16.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>thinkgem</id>
|
||||
<name>WangZhen</name>
|
||||
<email>thinkgem at 163.com</email>
|
||||
<roles><role>Project lead</role></roles>
|
||||
<timezone>+8</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<organization>
|
||||
<name>JeeSite</name>
|
||||
<url>http://jeesite.com</url>
|
||||
</organization>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,118 @@
|
||||
package com.jeesite.modules.maxkey.base;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 长春叭哥
|
||||
* @version 2023-02-23
|
||||
*/
|
||||
public enum JustAuthPlatformInfo {
|
||||
|
||||
/**
|
||||
* 平台
|
||||
*/
|
||||
GITEE("Gitee", "", "", "v1.0.1", false),
|
||||
BAIDU("百度", "", "", "v1.0.1", false),
|
||||
CODING("coding", "", "", "v1.0.1", false),
|
||||
CSDN("CSDN", "", "", "v1.0.1", false),
|
||||
DINGTALK("钉钉扫码登录", "", "", "v1.0.1", false),
|
||||
GITHUB("Github", "", "", "v1.0.1", false),
|
||||
OSCHINA("开源中国", "", "", "v1.0.1", false),
|
||||
ALIPAY("支付宝", "", "", "v1.0.1", false),
|
||||
WEIBO("微博", "", "", "v1.0.1", false),
|
||||
|
||||
DOUYIN("抖音", "", "", "v1.4.0", false),
|
||||
ELEME("饿了么", "", "", "v1.12.0", false),
|
||||
FACEBOOK("Facebook", "", "", "v1.3.0", false),
|
||||
GITLAB("Gitlab", "", "", "v1.11.0", false),
|
||||
GOOGLE("Google", "", "", "v1.3.0", false),
|
||||
HUAWEI("华为", "", "", "v1.10.0", false),
|
||||
JD("京东", "", "", "v1.15.1", false),
|
||||
KUJIALE("酷家乐", "", "", "v1.11.0", false),
|
||||
LINKEDIN("领英", "", "", "v1.4.0", false),
|
||||
MEITUAN("美团", "", "", "v1.12.0", false),
|
||||
MICROSOFT("微软", "", "", "v1.5.0", false),
|
||||
MI("小米", "", "", "v1.5.0", false),
|
||||
PINTEREST("Pinterest", "", "", "v1.9.0", false),
|
||||
QQ("QQ", "", "", "v1.1.0", false),
|
||||
RENREN("人人", "", "", "v1.9.0", false),
|
||||
STACK_OVERFLOW("Stack Overflow", "", "", "v1.9.0", false),
|
||||
TAOBAO("淘宝", "", "", "v1.2.0", false),
|
||||
TEAMBITION("Teambition", "", "", "v1.9.0", false),
|
||||
WECHAT_ENTERPRISE("企业微信二维码登录", "", "", "v1.10.0", false),
|
||||
WECHAT_MP("微信公众平台", "", "", "v1.14.0", false),
|
||||
WECHAT_OPEN("微信开放平台", "", "", "v1.1.0", false),
|
||||
TOUTIAO("今日头条", "", "", "v1.6.0-beta", false),
|
||||
TWITTER("推特", "", "", "v1.13.0", false),
|
||||
ALIYUN("阿里云", "", "", "v1.15.5", false),
|
||||
MYGITLAB("自定义的Gitlab", "", "", "v1.13.0", false),
|
||||
XMLY("喜马拉雅", "", "", "v1.15.9", false),
|
||||
WECHAT_ENTERPRISE_WEB("企业微信网页登录", "", "", "v1.15.9", false),
|
||||
FEISHU("飞书", "", "", "1.15.9", false),
|
||||
AMAZON("Amazon", "", "", "1.16.0", true),
|
||||
DINGTALK_ACCOUNT("钉钉账号登录", "", "", "v1.16.0", true),
|
||||
SLACK("slack 登录", "", "", "v1.16.0", true),
|
||||
LINE("line 登录", "", "", "v1.16.0", true),
|
||||
okta("Okta 登录", "", "", "v1.16.0", true),
|
||||
proginn("程序员客栈", "", "", "v1.16.2", true),
|
||||
;
|
||||
|
||||
// 平台名
|
||||
private final String name;
|
||||
// 帮助文档
|
||||
private final String readme;
|
||||
// 官网api文档
|
||||
private final String apiDoc;
|
||||
// 集成该平台的 版本
|
||||
private final String since;
|
||||
private final boolean latest;
|
||||
|
||||
JustAuthPlatformInfo(String name, String readme, String apiDoc, String since, boolean latest) {
|
||||
this.name = name;
|
||||
this.readme = readme;
|
||||
this.apiDoc = apiDoc;
|
||||
this.since = since;
|
||||
this.latest = latest;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> getPlatformInfos() {
|
||||
List<Map<String, Object>> list = new LinkedList<>();
|
||||
Map<String, Object> map = null;
|
||||
JustAuthPlatformInfo[] justAuthPlatformInfos = JustAuthPlatformInfo.values();
|
||||
for (JustAuthPlatformInfo justAuthPlatformInfo : justAuthPlatformInfos) {
|
||||
map = new HashMap<>();
|
||||
map.put("name", justAuthPlatformInfo.getName());
|
||||
map.put("readme", justAuthPlatformInfo.getReadme());
|
||||
map.put("apiDoc", justAuthPlatformInfo.getApiDoc());
|
||||
map.put("since", justAuthPlatformInfo.getSince());
|
||||
map.put("enname", justAuthPlatformInfo.name().toLowerCase());
|
||||
map.put("isLatest", justAuthPlatformInfo.isLatest());
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getReadme() {
|
||||
return readme;
|
||||
}
|
||||
|
||||
public String getApiDoc() {
|
||||
return apiDoc;
|
||||
}
|
||||
|
||||
public String getSince() {
|
||||
return since;
|
||||
}
|
||||
|
||||
public boolean isLatest() {
|
||||
return latest;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.jeesite.modules.maxkey.oauth.realm.request;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.mapper.JsonMapper;
|
||||
import com.jeesite.modules.maxkey.base.AuthCustomSource;
|
||||
import com.jeesite.modules.maxkey.utils.AuthCustomExceptionUtils;
|
||||
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.config.AuthSource;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.model.AuthToken;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthDefaultRequest;
|
||||
|
||||
public class AuthMaxKeyJeeGitRequest extends AuthDefaultRequest {
|
||||
|
||||
public static final String BASE_HOST = Global.getProperty("oauth2.maxkey.serverUrl");
|
||||
|
||||
/**
|
||||
* 设定归属域
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
public AuthMaxKeyJeeGitRequest(AuthConfig config) {
|
||||
super(config, AuthCustomSource.MAXKEY);
|
||||
}
|
||||
|
||||
public AuthMaxKeyJeeGitRequest(AuthConfig config, AuthSource source) {
|
||||
super(config, source);
|
||||
}
|
||||
|
||||
public AuthMaxKeyJeeGitRequest(AuthConfig config, AuthStateCache authStateCache) {
|
||||
super(config, AuthCustomSource.MAXKEY, authStateCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AuthToken getAccessToken(AuthCallback authCallback) {
|
||||
String body = doPostAuthorizationCode(authCallback.getCode());
|
||||
JSONObject object = JSONObject.parseObject(body);
|
||||
System.out.println("getAccessToken:"+JsonMapper.toJson(object));
|
||||
AuthCustomExceptionUtils.checkResponse(object);
|
||||
return AuthToken.builder().accessToken(object.getString("access_token")).refreshToken(object.getString("refresh_token")).idToken(object.getString("id_token")).tokenType(object.getString("token_type")).scope(object.getString("scope")).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
||||
String body = doGetUserInfo(authToken);
|
||||
JSONObject object = JSONObject.parseObject(body);
|
||||
AuthCustomExceptionUtils.checkResponse(object);
|
||||
return AuthUser.builder().uuid(object.getString("id")).username(object.getString("username")).nickname(object.getString("name")).avatar(object.getString("avatar_url")).blog(object.getString("web_url")).company(object.getString("organization")).location(object.getString("location")).email(object.getString("email")).remark(object.getString("bio")).token(authToken).source(source.toString()).build();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.jeesite.modules.maxkey.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import me.zhyd.oauth.exception.AuthException;
|
||||
|
||||
public class AuthCustomExceptionUtils {
|
||||
|
||||
public static void checkResponse(JSONObject object) {
|
||||
// oauth/token 验证异常
|
||||
if (object.containsKey("error")) {
|
||||
throw new AuthException(object.getString("error_description"));
|
||||
}
|
||||
// user 验证异常
|
||||
if (object.containsKey("message")) {
|
||||
throw new AuthException(object.getString("message"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package com.jeesite.modules.maxkey.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.mapper.JsonMapper;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.maxkey.base.IBaseJustOauth2Controller;
|
||||
import com.jeesite.modules.maxkey.utils.Oauth2UserLoginUtils;
|
||||
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
|
||||
/**
|
||||
* 推荐参考案例https://github.com/justauth/JustAuth-demo/blob/master/src/main/java/me/zhyd/justauth/RestAuthController.java
|
||||
* JustAuth 控制层
|
||||
*
|
||||
* @author 长春叭哥
|
||||
* @version 2023-02-23
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping({ "/oauth2" })
|
||||
public class JustOauth2Controller extends BaseController implements IBaseJustOauth2Controller {
|
||||
|
||||
@Override
|
||||
@RequestMapping({"/login/{source}"})
|
||||
public String login(String source, HttpServletRequest request) {
|
||||
// TODO Auto-generated method stub
|
||||
logger.debug(source);
|
||||
return "redirect:" + Oauth2UserLoginUtils.getAuthRequest(source).authorize((request.getParameter("state") == null ? AuthStateUtils.createState() : request.getParameter("state")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping({"/callback/{source}"})
|
||||
public String callback(String source, AuthCallback callback, RedirectAttributes redirectAttributes, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
// TODO Auto-generated method stub
|
||||
logger.debug(source);
|
||||
|
||||
AuthRequest authRequest = Oauth2UserLoginUtils.getAuthRequest(source);
|
||||
AuthResponse<?> rauthResponse = authRequest.login(callback);
|
||||
if(rauthResponse.getData() instanceof AuthUser) {
|
||||
AuthUser authUser = (AuthUser) rauthResponse.getData();
|
||||
//处理相关的绑定业务,该处仅做简单集成与演示专用。
|
||||
logger.debug("authUser:"+JsonMapper.toJson(authUser));
|
||||
Oauth2UserLoginUtils.loginByOauthUserId(authUser.getUsername());
|
||||
return renderResult(Global.TRUE, text("回调信息获取成功!"));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping({"/binder"})
|
||||
@ResponseBody
|
||||
public String binder(String id, String username, String password, String validCode, HttpServletRequest request, HttpServletResponse response) {
|
||||
// TODO Auto-generated method stub
|
||||
logger.debug(id, username);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequestMapping({"/unbind"})
|
||||
@ResponseBody
|
||||
public String unbind(String id, HttpServletRequest request, HttpServletResponse response) {
|
||||
// TODO Auto-generated method stub
|
||||
logger.debug(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
5.2.1
|
||||
@ -0,0 +1,13 @@
|
||||
|
||||
# 集成
|
||||
|
||||
第三方与MaxKey集成的插件、例子及文档
|
||||
|
||||
| 集成类型 | 描述 |
|
||||
| --------| :----- |
|
||||
| cas-springboot-demo | SpringBoot开发的CAS协议客户端集成的介绍 |
|
||||
| jeesite/5.2.1 | jeesite集成插件及使用介绍 |
|
||||
| Spring-Security-Oauth2-SSO | Spring-Security-Oauth2-SSO|
|
||||
| *_* | *_* |
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.unicom.sso</groupId>
|
||||
<artifactId>sso-springboot-sample</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sso-bigdata-cas-starter-demo</artifactId>
|
||||
<description>cas 单点登录demo</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--单点登录依赖-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.unicom.sso</groupId>-->
|
||||
<!-- <artifactId>unicom-sso-bigdata-cas-springboot-starter</artifactId>-->
|
||||
<!-- <version>0.0.1-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-cas</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,17 @@
|
||||
package com.unicom.sso.bigdata.cas.demo;
|
||||
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
/**
|
||||
* cas 单点
|
||||
* @author baihz10
|
||||
* @date 2023/7/7 15:18
|
||||
*/
|
||||
//@EnableCasClient
|
||||
@SpringBootApplication
|
||||
public class CasApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CasApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
|
||||
public class AuthorityInfo implements GrantedAuthority {
|
||||
private static final long serialVersionUID = -175781100474818800L;
|
||||
|
||||
/**
|
||||
* 权限CODE
|
||||
*/
|
||||
private String authority;
|
||||
|
||||
public AuthorityInfo(String authority) {
|
||||
this.authority = authority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthority() {
|
||||
return authority;
|
||||
}
|
||||
|
||||
public void setAuthority(String authority) {
|
||||
this.authority = authority;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
import org.jasig.cas.client.session.SingleSignOutFilter;
|
||||
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
|
||||
import org.jasig.cas.client.validation.Cas30ProxyTicketValidator;
|
||||
import org.jasig.cas.client.validation.Cas30ServiceTicketValidator;
|
||||
import org.jasig.cas.client.validation.TicketValidator;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.cas.ServiceProperties;
|
||||
import org.springframework.security.cas.authentication.CasAuthenticationProvider;
|
||||
import org.springframework.security.cas.web.CasAuthenticationEntryPoint;
|
||||
import org.springframework.security.cas.web.CasAuthenticationFilter;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@Configuration
|
||||
public class CasConfig {
|
||||
|
||||
@Value("${cas.server.url}")
|
||||
private String casServerUrl;
|
||||
@Value("${base.url}")
|
||||
private String baseUrl;
|
||||
|
||||
@Bean
|
||||
public AuthenticationEntryPoint authenticationEntryPoint() {
|
||||
CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint();
|
||||
entryPoint.setLoginUrl(casServerUrl + "/login");
|
||||
entryPoint.setServiceProperties(this.serviceProperties());
|
||||
return entryPoint;
|
||||
}
|
||||
|
||||
@Bean
|
||||
protected AuthenticationManager authenticationManager() throws Exception {
|
||||
return new ProviderManager(this.casAuthenticationProvider());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CasAuthenticationFilter casAuthenticationFilter() throws Exception {
|
||||
CasAuthenticationFilter filter = new CasAuthenticationFilter();
|
||||
filter.setAuthenticationManager(this.authenticationManager());
|
||||
filter.setServiceProperties(this.serviceProperties());
|
||||
filter.setAuthenticationFailureHandler(this.authenticationFailureHandler());
|
||||
filter.setAuthenticationSuccessHandler(this.authenticationSuccessHandler());
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationSuccessHandler authenticationSuccessHandler() {
|
||||
AuthenticationSuccessHandler authenticationSuccessHandler = new SimpleUrlAuthenticationSuccessHandler();
|
||||
|
||||
return authenticationSuccessHandler;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationFailureHandler authenticationFailureHandler() {
|
||||
AuthenticationFailureHandler authenticationFailureHandler = new SimpleUrlAuthenticationFailureHandler();
|
||||
|
||||
return authenticationFailureHandler;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServiceProperties serviceProperties() {
|
||||
ServiceProperties serviceProperties = new ServiceProperties();
|
||||
serviceProperties.setService(baseUrl);
|
||||
serviceProperties.setSendRenew(false);
|
||||
return serviceProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TicketValidator ticketValidator() {
|
||||
return new Cas30ProxyTicketValidator(casServerUrl);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CasAuthenticationProvider casAuthenticationProvider() {
|
||||
CasAuthenticationProvider provider = new CasAuthenticationProvider();
|
||||
provider.setServiceProperties(this.serviceProperties());
|
||||
provider.setTicketValidator(this.ticketValidator());
|
||||
provider.setAuthenticationUserDetailsService(new UserDetailsServiceImpl());
|
||||
provider.setKey("CAS_PROVIDER_LOCALHOST");
|
||||
return provider;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityContextLogoutHandler securityContextLogoutHandler() {
|
||||
return new SecurityContextLogoutHandler();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LogoutFilter logoutFilter() {
|
||||
LogoutFilter logoutFilter = new LogoutFilter(casServerUrl + "/logout?service=" + baseUrl,
|
||||
securityContextLogoutHandler());
|
||||
logoutFilter.setFilterProcessesUrl("/logout/cas");
|
||||
return logoutFilter;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SingleSignOutFilter singleSignOutFilter() {
|
||||
SingleSignOutFilter singleSignOutFilter = new SingleSignOutFilter();
|
||||
singleSignOutFilter.setIgnoreInitConfiguration(true);
|
||||
return singleSignOutFilter;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* CAS的配置参数
|
||||
*/
|
||||
@Component
|
||||
public class CasProperties {
|
||||
@Value("${cas.server.host.url}")
|
||||
private String casServerUrl;
|
||||
|
||||
@Value("${cas.server.host.login_url}")
|
||||
private String casServerLoginUrl;
|
||||
|
||||
@Value("${cas.server.host.logout_url}")
|
||||
private String casServerLogoutUrl;
|
||||
|
||||
@Value("${app.casEnable}")
|
||||
private boolean casEnable;
|
||||
|
||||
@Value("${app.server.host.url}")
|
||||
private String appServerUrl;
|
||||
|
||||
@Value("${app.login_url}")
|
||||
private String appLoginUrl;
|
||||
|
||||
@Value("${app.logout_url}")
|
||||
private String appLogoutUrl;
|
||||
|
||||
@Value("${app.web_url}")
|
||||
private String webUrl;
|
||||
|
||||
public String getWebUrl() {
|
||||
return webUrl;
|
||||
}
|
||||
|
||||
public String getCasServerUrl() {
|
||||
return casServerUrl;
|
||||
}
|
||||
|
||||
public void setCasServerUrl(String casServerUrl) {
|
||||
this.casServerUrl = casServerUrl;
|
||||
}
|
||||
|
||||
public String getCasServerLoginUrl() {
|
||||
return casServerLoginUrl;
|
||||
}
|
||||
|
||||
public void setCasServerLoginUrl(String casServerLoginUrl) {
|
||||
this.casServerLoginUrl = casServerLoginUrl;
|
||||
}
|
||||
|
||||
public String getCasServerLogoutUrl() {
|
||||
return casServerLogoutUrl;
|
||||
}
|
||||
|
||||
public void setCasServerLogoutUrl(String casServerLogoutUrl) {
|
||||
this.casServerLogoutUrl = casServerLogoutUrl;
|
||||
}
|
||||
|
||||
public boolean isCasEnable() {
|
||||
return casEnable;
|
||||
}
|
||||
|
||||
public void setCasEnable(boolean casEnable) {
|
||||
this.casEnable = casEnable;
|
||||
}
|
||||
|
||||
public String getAppServerUrl() {
|
||||
return appServerUrl;
|
||||
}
|
||||
|
||||
public void setAppServerUrl(String appServerUrl) {
|
||||
this.appServerUrl = appServerUrl;
|
||||
}
|
||||
|
||||
public String getAppLoginUrl() {
|
||||
return appLoginUrl;
|
||||
}
|
||||
|
||||
public void setAppLoginUrl(String appLoginUrl) {
|
||||
this.appLoginUrl = appLoginUrl;
|
||||
}
|
||||
|
||||
public String getAppLogoutUrl() {
|
||||
return appLogoutUrl;
|
||||
}
|
||||
|
||||
public void setAppLogoutUrl(String appLogoutUrl) {
|
||||
this.appLogoutUrl = appLogoutUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
|
||||
public class CustomUserDetailsService implements UserDetailsService {
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
|
||||
// 可自定义获取用户信息
|
||||
return new User("admin", "admin", true, true, true, true,
|
||||
AuthorityUtils.createAuthorityList("ROLE_ADMIN"));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
|
||||
{
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
|
||||
{
|
||||
tokenService.verifyToken(loginUser);
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
|
||||
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
||||
}
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,233 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class LoginUser implements UserDetails
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户唯一标识
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
private Long loginTime;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Long expireTime;
|
||||
|
||||
/**
|
||||
* 登录IP地址
|
||||
*/
|
||||
private String ipaddr;
|
||||
|
||||
/**
|
||||
* 登录地点
|
||||
*/
|
||||
private String loginLocation;
|
||||
|
||||
/**
|
||||
* 浏览器类型
|
||||
*/
|
||||
private String browser;
|
||||
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String os;
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*/
|
||||
private Set<String> permissions;
|
||||
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getToken()
|
||||
{
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token)
|
||||
{
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public LoginUser()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 账户是否未过期,过期无法验证
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public boolean isAccountNonExpired()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定用户是否解锁,锁定的用户无法进行身份验证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public boolean isAccountNonLocked()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public boolean isCredentialsNonExpired()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可用 ,禁用的用户不能身份验证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public Long getLoginTime()
|
||||
{
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
public void setLoginTime(Long loginTime)
|
||||
{
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
|
||||
public String getIpaddr()
|
||||
{
|
||||
return ipaddr;
|
||||
}
|
||||
|
||||
public void setIpaddr(String ipaddr)
|
||||
{
|
||||
this.ipaddr = ipaddr;
|
||||
}
|
||||
|
||||
public String getLoginLocation()
|
||||
{
|
||||
return loginLocation;
|
||||
}
|
||||
|
||||
public void setLoginLocation(String loginLocation)
|
||||
{
|
||||
this.loginLocation = loginLocation;
|
||||
}
|
||||
|
||||
public String getBrowser()
|
||||
{
|
||||
return browser;
|
||||
}
|
||||
|
||||
public void setBrowser(String browser)
|
||||
{
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
public String getOs()
|
||||
{
|
||||
return os;
|
||||
}
|
||||
|
||||
public void setOs(String os)
|
||||
{
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
public Long getExpireTime()
|
||||
{
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(Long expireTime)
|
||||
{
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public Set<String> getPermissions()
|
||||
{
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(Set<String> permissions)
|
||||
{
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities()
|
||||
{
|
||||
return new HashSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
public class TokenService {
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.security.cas.authentication.CasAssertionAuthenticationToken;
|
||||
import org.springframework.security.core.userdetails.AuthenticationUserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class UserDetailsServiceImpl implements AuthenticationUserDetailsService<CasAssertionAuthenticationToken> {
|
||||
@Override
|
||||
public UserDetails loadUserDetails(CasAssertionAuthenticationToken token) throws UsernameNotFoundException {
|
||||
System.out.println("getCredentials:" + token.getCredentials());
|
||||
String username = token.getName();
|
||||
System.out.println(username);
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setUsername("admin");
|
||||
userInfo.setName("admin");
|
||||
Set<AuthorityInfo> authorities = new HashSet<AuthorityInfo>();
|
||||
AuthorityInfo authorityInfo = new AuthorityInfo("TEST");
|
||||
authorities.add(authorityInfo);
|
||||
userInfo.setAuthorities(authorities);
|
||||
return userInfo;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class UserInfo implements UserDetails {
|
||||
private static final long serialVersionUID = -1041327031937199938L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Getter
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@Getter
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 登录名称
|
||||
*/
|
||||
@Getter
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 登录密码
|
||||
*/
|
||||
@Getter
|
||||
private String password;
|
||||
|
||||
private boolean isAccountNonExpired = true;
|
||||
|
||||
private boolean isAccountNonLocked = true;
|
||||
|
||||
private boolean isCredentialsNonExpired = true;
|
||||
|
||||
private boolean isEnabled = true;
|
||||
|
||||
@Getter
|
||||
private Set<AuthorityInfo> authorities = new HashSet<AuthorityInfo>();
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public boolean isAccountNonExpired() {
|
||||
return isAccountNonExpired;
|
||||
}
|
||||
|
||||
public void setAccountNonExpired(boolean accountNonExpired) {
|
||||
isAccountNonExpired = accountNonExpired;
|
||||
}
|
||||
|
||||
public boolean isAccountNonLocked() {
|
||||
return isAccountNonLocked;
|
||||
}
|
||||
|
||||
public void setAccountNonLocked(boolean accountNonLocked) {
|
||||
isAccountNonLocked = accountNonLocked;
|
||||
}
|
||||
|
||||
public boolean isCredentialsNonExpired() {
|
||||
return isCredentialsNonExpired;
|
||||
}
|
||||
|
||||
public void setCredentialsNonExpired(boolean credentialsNonExpired) {
|
||||
isCredentialsNonExpired = credentialsNonExpired;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
isEnabled = enabled;
|
||||
}
|
||||
|
||||
public void setAuthorities(Set<AuthorityInfo> authorities) {
|
||||
this.authorities = authorities;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.controller;
|
||||
|
||||
import org.jasig.cas.client.util.AbstractCasFilter;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* cas 回调地址
|
||||
* @author baihz10
|
||||
* @date 2023/7/7 15:44
|
||||
*/
|
||||
@Controller
|
||||
public class HelloController {
|
||||
|
||||
@GetMapping("/hello")
|
||||
public String home(Model model, HttpServletRequest request) {
|
||||
// String token =request.getParameter("token");
|
||||
// System.out.println("token : "+token);
|
||||
// Assertion assertion = (Assertion) request.getSession().getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
|
||||
//
|
||||
// String username= assertion.getPrincipal().getName();
|
||||
// System.out.println("cas user:"+username);
|
||||
//
|
||||
// username = Optional.ofNullable(username).orElse("anonymous");
|
||||
// Map<String, Object> attributes = Optional.ofNullable(assertion.getPrincipal().getAttributes()).orElse(new HashMap<>());
|
||||
//
|
||||
// model.addAttribute("username", username);
|
||||
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
System.out.println("当前用户信息:" + auth.getPrincipal());
|
||||
return "home";
|
||||
}
|
||||
|
||||
@GetMapping("/hello2")
|
||||
public String home2(Model model, HttpServletRequest request) {
|
||||
String token =request.getParameter("token");
|
||||
System.out.println("token : "+token);
|
||||
Assertion assertion = (Assertion) request.getSession().getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
|
||||
|
||||
String username= assertion.getPrincipal().getName();
|
||||
System.out.println("cas user:"+username);
|
||||
|
||||
username = Optional.ofNullable(username).orElse("anonymous");
|
||||
Map<String, Object> attributes = Optional.ofNullable(assertion.getPrincipal().getAttributes()).orElse(new HashMap<>());
|
||||
|
||||
model.addAttribute("username", username);
|
||||
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
System.out.println("当前用户信息:" + auth.getPrincipal());
|
||||
return "home";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.unicom.sso.bigdata.cas.demo.controller;
|
||||
|
||||
import org.jasig.cas.client.util.AbstractCasFilter;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 控制类
|
||||
* @author baihz10
|
||||
* @date 2023/7/7 15:44
|
||||
*/
|
||||
@Controller
|
||||
public class SsoLoginController {
|
||||
|
||||
@GetMapping("/caslogin")
|
||||
public String home(Model model,HttpServletRequest request) {
|
||||
Assertion assertion = (Assertion) request.getSession().getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
|
||||
|
||||
String username= assertion.getPrincipal().getName();
|
||||
username = Optional.ofNullable(username).orElse("anonymous");
|
||||
model.addAttribute("username", username);
|
||||
return "cas/login";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
server.port=10002
|
||||
|
||||
#spring.profiles.active=cas-test
|
||||
|
||||
base.url=http://cas.demo.maxkey.top:10002
|
||||
cas.server.url=http://192.168.202.102:8080/sign/authz/cas
|
||||
|
||||
#CAS
|
||||
cas.server.host.url=http://192.168.202.102:8080/sign/authz/cas
|
||||
#CAS????
|
||||
|
||||
#CAS??????
|
||||
cas.server.host.login_url=${cas.server.host.url}/login
|
||||
#CAS??????
|
||||
cas.server.host.logout_url=${cas.server.host.url}/logout?service=${app.server.host.url}
|
||||
# ??????
|
||||
app.casEnable=true
|
||||
app.server.host.url=http://192.168.202.102:${server.port}
|
||||
|
||||
#??????
|
||||
app.server.host.login_url=/
|
||||
#??????
|
||||
app.server.host.logout_url=/logout
|
||||
#??????
|
||||
app.server.host.web_url=http://192.168.202.102/index
|
||||
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>sso cas demo</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2 >Login with CAS</h2>
|
||||
login user : [[${username}]]
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>home</title>
|
||||
</head>
|
||||
<body>
|
||||
hello cas
|
||||
<br>
|
||||
hello [[${username}]]
|
||||
userInfo: [[${userInfo}]]
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@ -0,0 +1,62 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.concretepage</groupId>
|
||||
<artifactId>spring-demo-client</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>spring-demo</name>
|
||||
<description>Spring Demo</description>
|
||||
|
||||
<modules>
|
||||
<module>spring-demo-client1</module>
|
||||
<module>spring-demo-client2</module>
|
||||
</modules>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.5.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<properties>
|
||||
<context.path>spring-app</context.path>
|
||||
<java.version>8</java.version>
|
||||
</properties>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||
<version>2.1.5.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@ -0,0 +1,19 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.concretepage</groupId>
|
||||
<artifactId>spring-demo-client</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>spring-demo-client1</name>
|
||||
<artifactId>spring-demo-client1</artifactId>
|
||||
<description> </description>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
package com.concretepage.client1;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class AppController {
|
||||
@GetMapping("hello")
|
||||
public ModelAndView welcome() {
|
||||
ModelAndView mav = new ModelAndView();
|
||||
mav.setViewName("welcome");
|
||||
return mav;
|
||||
}
|
||||
@GetMapping("error")
|
||||
public ModelAndView error() {
|
||||
Map<String, String> model = new HashMap<>();
|
||||
ModelAndView mav = new ModelAndView();
|
||||
mav.setViewName("error");
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.concretepage.client1;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class MainClient1 {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MainClient1.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.concretepage.client1;
|
||||
|
||||
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
@Configuration
|
||||
@EnableOAuth2Sso
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeRequests()
|
||||
.antMatchers("/", "/error**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and().logout().logoutUrl("/logout")
|
||||
.logoutSuccessUrl("http://sso.maxkey.top/sign/force/logout");
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
server:
|
||||
port: 8080
|
||||
security:
|
||||
oauth2:
|
||||
client:
|
||||
clientId: 830447866781630464
|
||||
clientSecret: QnGYMDcwMzIwMjMxMTQ0MjYwNDcFli
|
||||
accessTokenUri: http://sso.maxkey.top/sign/authz/oauth/v20/token
|
||||
userAuthorizationUri: http://sso.maxkey.top/sign/authz/oauth/v20/authorize
|
||||
clientAuthenticationScheme: form
|
||||
resource:
|
||||
userInfoUri: http://sso.maxkey.top/sign/api/oauth/v20/me
|
||||
sso:
|
||||
login-path: /login
|
||||
logging:
|
||||
level:
|
||||
root: debug
|
||||
|
||||
spring:
|
||||
mvc:
|
||||
favicon:
|
||||
enabled: false
|
||||
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Spring Security</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
</head>
|
||||
<body>
|
||||
<h3>Login with <a href="/hello">GitHub</a></h3>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Spring Security</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
</head>
|
||||
<body>
|
||||
<h3>Error</h3>
|
||||
<p th:if="${param.error}">
|
||||
<div th:text="${param.error}"></div>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Welcome</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
</head>
|
||||
<body>
|
||||
Welcome <b th:inline="text" > [[${#httpServletRequest.remoteUser}]] </b> <br/><br/>
|
||||
<form th:action="@{/logout}" method="POST">
|
||||
<input type="submit" value="Logout"/>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,16 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.concretepage</groupId>
|
||||
<artifactId>spring-demo-client</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<name>spring-demo-client2</name>
|
||||
<artifactId>spring-demo-client2</artifactId>
|
||||
<description> </description>
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
package com.concretepage.client2;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class AppController {
|
||||
@GetMapping("hello")
|
||||
public ModelAndView welcome() {
|
||||
ModelAndView mav = new ModelAndView();
|
||||
mav.setViewName("welcome");
|
||||
return mav;
|
||||
}
|
||||
@GetMapping("error")
|
||||
public ModelAndView error() {
|
||||
Map<String, String> model = new HashMap<>();
|
||||
ModelAndView mav = new ModelAndView();
|
||||
mav.setViewName("error");
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.concretepage.client2;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class MainClient2 {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MainClient2.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.concretepage.client2;
|
||||
|
||||
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
@Configuration
|
||||
@EnableOAuth2Sso
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeRequests()
|
||||
.antMatchers("/", "/error**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and().logout().logoutUrl("/logout")
|
||||
.logoutSuccessUrl("http://sso.maxkey.top/sign/force/logout");
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
server:
|
||||
port: 8081
|
||||
security:
|
||||
oauth2:
|
||||
client:
|
||||
clientId: 830517174152986624
|
||||
clientSecret: ElHEMDcwMzIwMjMxNjE5NTAyMTIx1K
|
||||
accessTokenUri: http://sso.maxkey.top/sign/authz/oauth/v20/token
|
||||
userAuthorizationUri: http://sso.maxkey.top/sign/authz/oauth/v20/authorize
|
||||
clientAuthenticationScheme: form
|
||||
resource:
|
||||
userInfoUri: http://sso.maxkey.top/sign/api/oauth/v20/me
|
||||
sso:
|
||||
login-path: /login
|
||||
logging:
|
||||
level:
|
||||
root: debug
|
||||
|
||||
spring:
|
||||
mvc:
|
||||
favicon:
|
||||
enabled: false
|
||||
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Spring Security</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
</head>
|
||||
<body>
|
||||
<h3>Login with <a href="/hello">GitHub</a></h3>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Spring Security</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
</head>
|
||||
<body>
|
||||
<h3>Error</h3>
|
||||
<p th:if="${param.error}">
|
||||
<div th:text="${param.error}"></div>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Welcome</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
</head>
|
||||
<body>
|
||||
Welcome <b th:inline="text" > [[${#httpServletRequest.remoteUser}]] </b> <br/><br/>
|
||||
<form th:action="@{/logout}" method="POST">
|
||||
<input type="submit" value="Logout"/>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||