Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
e0a274fa
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e0a274fa
编写于
1月 13, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mv to repository
上级
bd04a24b
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
884 addition
and
306 deletion
+884
-306
maxkey-authentications/maxkey-authentication-captcha/src/main/java/com/google/code/kaptcha/impl/LightNoise.java
...rc/main/java/com/google/code/kaptcha/impl/LightNoise.java
+18
-1
maxkey-authentications/maxkey-authentication-captcha/src/main/java/com/google/code/kaptcha/impl/Ripple.java
...ha/src/main/java/com/google/code/kaptcha/impl/Ripple.java
+17
-0
maxkey-authentications/maxkey-authentication-captcha/src/main/java/com/google/code/kaptcha/text/impl/RandomColorWordRenderer.java
...oogle/code/kaptcha/text/impl/RandomColorWordRenderer.java
+17
-0
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
...a/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
+15
-15
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java
.../org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java
+16
-15
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java
...maxkey/autoconfigure/AuthenticationAutoConfiguration.java
+9
-9
maxkey-common/src/main/java/org/maxkey/util/ExcelUtils.java
maxkey-common/src/main/java/org/maxkey/util/ExcelUtils.java
+17
-0
maxkey-common/src/test/java/org/maxkey/Copyright.java
maxkey-common/src/test/java/org/maxkey/Copyright.java
+1
-1
maxkey-common/src/test/java/org/maxkey/Integer2LongTest.java
maxkey-common/src/test/java/org/maxkey/Integer2LongTest.java
+17
-0
maxkey-common/src/test/java/org/maxkey/copyright.txt
maxkey-common/src/test/java/org/maxkey/copyright.txt
+1
-1
maxkey-common/src/test/java/org/maxkey/util/InstanceTest.java
...ey-common/src/test/java/org/maxkey/util/InstanceTest.java
+17
-0
maxkey-common/src/test/java/org/maxkey/word/RunJavaEnvs.java
maxkey-common/src/test/java/org/maxkey/word/RunJavaEnvs.java
+17
-0
maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java
...rg/maxkey/autoconfigure/ApplicationAutoConfiguration.java
+9
-8
maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java
...n/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java
+8
-8
maxkey-core/src/main/java/org/maxkey/entity/LdapContext.java
maxkey-core/src/main/java/org/maxkey/entity/LdapContext.java
+280
-0
maxkey-core/src/main/java/org/maxkey/entity/Localization.java
...ey-core/src/main/java/org/maxkey/entity/Localization.java
+17
-0
maxkey-core/src/main/java/org/maxkey/persistence/repository/InstitutionsRepository.java
...maxkey/persistence/repository/InstitutionsRepository.java
+4
-4
maxkey-core/src/main/java/org/maxkey/persistence/repository/LocalizationRepository.java
...maxkey/persistence/repository/LocalizationRepository.java
+7
-7
maxkey-core/src/main/java/org/maxkey/persistence/repository/LoginHistoryRepository.java
...maxkey/persistence/repository/LoginHistoryRepository.java
+4
-4
maxkey-core/src/main/java/org/maxkey/persistence/repository/LoginRepository.java
...va/org/maxkey/persistence/repository/LoginRepository.java
+5
-5
maxkey-core/src/main/java/org/maxkey/persistence/repository/PasswordPolicyMessageResolver.java
...persistence/repository/PasswordPolicyMessageResolver.java
+1
-1
maxkey-core/src/main/java/org/maxkey/persistence/repository/PasswordPolicyRepository.java
...xkey/persistence/repository/PasswordPolicyRepository.java
+185
-0
maxkey-core/src/main/java/org/maxkey/persistence/repository/PasswordPolicyValidator.java
...axkey/persistence/repository/PasswordPolicyValidator.java
+14
-157
maxkey-core/src/main/java/org/maxkey/web/SessionListenerAdapter.java
.../src/main/java/org/maxkey/web/SessionListenerAdapter.java
+18
-18
maxkey-core/src/main/java/org/maxkey/web/WebInstRequestFilter.java
...re/src/main/java/org/maxkey/web/WebInstRequestFilter.java
+5
-5
maxkey-core/src/main/java/org/maxkey/web/tag/LocaleTagDirective.java
.../src/main/java/org/maxkey/web/tag/LocaleTagDirective.java
+2
-2
maxkey-gataway/src/main/java/org/gateway/GatewayApplication.java
...gataway/src/main/java/org/gateway/GatewayApplication.java
+17
-0
maxkey-gataway/src/main/java/org/gateway/controller/FallbackController.java
.../main/java/org/gateway/controller/FallbackController.java
+17
-0
maxkey-gataway/src/main/java/org/gateway/filter/AuthAndLogFilter.java
...ay/src/main/java/org/gateway/filter/AuthAndLogFilter.java
+17
-0
maxkey-gataway/src/main/java/org/gateway/route/NacosDynamicRouteService.java
...main/java/org/gateway/route/NacosDynamicRouteService.java
+17
-0
maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/resources/ScimParameters.java
...va/org/maxkey/identity/scim/resources/ScimParameters.java
+17
-0
maxkey-persistence/src/main/java/org/maxkey/persistence/service/UserInfoService.java
.../java/org/maxkey/persistence/service/UserInfoService.java
+1
-1
maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java
...axkey/authz/oauth2/provider/OAuth2UserDetailsService.java
+9
-10
maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/autoconfigure/Oauth20AutoConfiguration.java
...va/org/maxkey/autoconfigure/Oauth20AutoConfiguration.java
+3
-3
maxkey-webs/maxkey-boot-monitor/src/main/java/org/maxkey/boot/monitor/MaxKeyBootMonitor.java
.../main/java/org/maxkey/boot/monitor/MaxKeyBootMonitor.java
+17
-0
maxkey-webs/maxkey-boot-monitor/src/main/java/org/maxkey/boot/monitor/MonitorSecurityConfigurer.java
...va/org/maxkey/boot/monitor/MonitorSecurityConfigurer.java
+17
-0
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyConfig.java
...key-web-maxkey/src/main/java/org/maxkey/MaxKeyConfig.java
+5
-5
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/ForgotPasswordContorller.java
...a/org/maxkey/web/contorller/ForgotPasswordContorller.java
+1
-1
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SafeController.java
...c/main/java/org/maxkey/web/contorller/SafeController.java
+1
-1
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/LoginSessionController.java
...axkey/web/historys/contorller/LoginSessionController.java
+6
-6
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/MaxKeyMgtConfig.java
...key-web-mgt/src/main/java/org/maxkey/MaxKeyMgtConfig.java
+7
-7
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/LocalizationController.java
...ava/org/maxkey/web/contorller/LocalizationController.java
+5
-5
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/historys/contorller/LoginSessionController.java
...axkey/web/historys/contorller/LoginSessionController.java
+6
-6
未找到文件。
maxkey-authentications/maxkey-authentication-captcha/src/main/java/com/google/code/kaptcha/impl/LightNoise.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
com.google.code.kaptcha.impl
;
import
java.awt.BasicStroke
;
...
...
@@ -91,4 +108,4 @@ public class LightNoise extends Configurable implements NoiseProducer
graph
.
dispose
();
}
}
\ No newline at end of file
}
maxkey-authentications/maxkey-authentication-captcha/src/main/java/com/google/code/kaptcha/impl/Ripple.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
com.google.code.kaptcha.impl
;
import
java.awt.Graphics2D
;
...
...
maxkey-authentications/maxkey-authentication-captcha/src/main/java/com/google/code/kaptcha/text/impl/RandomColorWordRenderer.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
com.google.code.kaptcha.text.impl
;
import
java.awt.Color
;
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
浏览文件 @
e0a274fa
...
...
@@ -26,10 +26,10 @@ import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import
org.maxkey.entity.Groups
;
import
org.maxkey.entity.HistoryLogin
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.db.LoginHistoryService
;
import
org.maxkey.persistence.db.PasswordPolicyValidator
;
import
org.maxkey.persistence.repository.LoginHistoryRepository
;
import
org.maxkey.persistence.repository.LoginRepository
;
import
org.maxkey.persistence.repository.PasswordPolicyValidator
;
import
org.maxkey.persistence.service.UserInfoService
;
import
org.maxkey.persistence.db.LoginService
;
import
org.maxkey.util.DateUtils
;
import
org.maxkey.web.WebConstants
;
import
org.maxkey.web.WebContext
;
...
...
@@ -52,9 +52,9 @@ public abstract class AbstractAuthenticationRealm {
protected
PasswordPolicyValidator
passwordPolicyValidator
;
protected
Login
Service
loginService
;
protected
Login
Repository
loginRepository
;
protected
LoginHistory
Service
loginHistoryService
;
protected
LoginHistory
Repository
loginHistoryRepository
;
protected
AbstractRemeberMeService
remeberMeService
;
...
...
@@ -81,12 +81,12 @@ public abstract class AbstractAuthenticationRealm {
return
passwordPolicyValidator
;
}
public
Login
Service
getUserInfoLoginService
()
{
return
login
Service
;
public
Login
Repository
getLoginRepository
()
{
return
login
Repository
;
}
public
UserInfo
loadUserInfo
(
String
username
,
String
password
)
{
return
login
Service
.
find
(
username
,
password
);
return
login
Repository
.
find
(
username
,
password
);
}
public
abstract
boolean
passwordMatches
(
UserInfo
userInfo
,
String
password
);
...
...
@@ -102,7 +102,7 @@ public abstract class AbstractAuthenticationRealm {
public
List
<
Groups
>
queryGroups
(
UserInfo
userInfo
)
{
return
login
Service
.
queryGroups
(
userInfo
);
return
login
Repository
.
queryGroups
(
userInfo
);
}
/**
...
...
@@ -112,7 +112,7 @@ public abstract class AbstractAuthenticationRealm {
* @return ArrayList<GrantedAuthority>
*/
public
ArrayList
<
GrantedAuthority
>
grantAuthority
(
UserInfo
userInfo
)
{
return
login
Service
.
grantAuthority
(
userInfo
);
return
login
Repository
.
grantAuthority
(
userInfo
);
}
/**
...
...
@@ -122,7 +122,7 @@ public abstract class AbstractAuthenticationRealm {
* @return ArrayList<GrantedAuthority Apps>
*/
public
ArrayList
<
GrantedAuthority
>
queryAuthorizedApps
(
ArrayList
<
GrantedAuthority
>
grantedAuthoritys
)
{
return
login
Service
.
queryAuthorizedApps
(
grantedAuthoritys
);
return
login
Repository
.
queryAuthorizedApps
(
grantedAuthoritys
);
}
/**
...
...
@@ -161,9 +161,9 @@ public abstract class AbstractAuthenticationRealm {
historyLogin
.
setDisplayName
(
userInfo
.
getDisplayName
());
historyLogin
.
setInstId
(
userInfo
.
getInstId
());
loginHistory
Service
.
login
(
historyLogin
);
loginHistory
Repository
.
login
(
historyLogin
);
login
Service
.
updateLastLogin
(
userInfo
);
login
Repository
.
updateLastLogin
(
userInfo
);
return
true
;
}
...
...
@@ -182,10 +182,10 @@ public abstract class AbstractAuthenticationRealm {
if
(
sessionIdAttribute
!=
null
)
{
remeberMeService
.
removeRemeberMe
(
response
);
loginHistory
Service
.
logoff
(
userInfo
.
getLastLogoffTime
(),
sessionIdAttribute
.
toString
());
loginHistory
Repository
.
logoff
(
userInfo
.
getLastLogoffTime
(),
sessionIdAttribute
.
toString
());
}
login
Service
.
updateLastLogoff
(
userInfo
);
login
Repository
.
updateLastLogoff
(
userInfo
);
_logger
.
debug
(
"Session "
+
WebContext
.
getAttribute
(
WebConstants
.
CURRENT_USER_SESSION_ID
)
+
", user "
+
userInfo
.
getUsername
()
+
" Logout, datetime "
+
userInfo
.
getLastLogoffTime
()
+
" ."
);
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/jdbc/JdbcAuthenticationRealm.java
浏览文件 @
e0a274fa
...
...
@@ -20,10 +20,11 @@ package org.maxkey.authn.realm.jdbc;
import
org.maxkey.authn.realm.AbstractAuthenticationRealm
;
import
org.maxkey.authn.support.rememberme.AbstractRemeberMeService
;
import
org.maxkey.constants.ConstantsLoginType
;
import
org.maxkey.entity.PasswordPolicy
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.
db.LoginHistoryService
;
import
org.maxkey.persistence.
db.LoginService
;
import
org.maxkey.persistence.
db
.PasswordPolicyValidator
;
import
org.maxkey.persistence.
repository.LoginHistoryRepository
;
import
org.maxkey.persistence.
repository.LoginRepository
;
import
org.maxkey.persistence.
repository
.PasswordPolicyValidator
;
import
org.maxkey.persistence.service.UserInfoService
;
import
org.maxkey.web.WebConstants
;
import
org.maxkey.web.WebContext
;
...
...
@@ -54,16 +55,16 @@ public class JdbcAuthenticationRealm extends AbstractAuthenticationRealm {
public
JdbcAuthenticationRealm
(
PasswordEncoder
passwordEncoder
,
PasswordPolicyValidator
passwordPolicyValidator
,
Login
Service
loginService
,
LoginHistory
Service
loginHistoryService
,
Login
Repository
loginRepository
,
LoginHistory
Repository
loginHistoryRepository
,
AbstractRemeberMeService
remeberMeService
,
UserInfoService
userInfoService
,
JdbcTemplate
jdbcTemplate
)
{
this
.
passwordEncoder
=
passwordEncoder
;
this
.
passwordPolicyValidator
=
passwordPolicyValidator
;
this
.
login
Service
=
loginService
;
this
.
loginHistory
Service
=
loginHistoryService
;
this
.
login
Repository
=
loginRepository
;
this
.
loginHistory
Repository
=
loginHistoryRepository
;
this
.
remeberMeService
=
remeberMeService
;
this
.
userInfoService
=
userInfoService
;
this
.
jdbcTemplate
=
jdbcTemplate
;
...
...
@@ -73,8 +74,8 @@ public class JdbcAuthenticationRealm extends AbstractAuthenticationRealm {
public
JdbcAuthenticationRealm
(
PasswordEncoder
passwordEncoder
,
PasswordPolicyValidator
passwordPolicyValidator
,
Login
Service
loginService
,
LoginHistory
Service
loginHistoryService
,
Login
Repository
loginRepository
,
LoginHistory
Repository
loginHistoryRepository
,
AbstractRemeberMeService
remeberMeService
,
UserInfoService
userInfoService
,
JdbcTemplate
jdbcTemplate
,
...
...
@@ -84,8 +85,8 @@ public class JdbcAuthenticationRealm extends AbstractAuthenticationRealm {
this
.
passwordEncoder
=
passwordEncoder
;
this
.
passwordPolicyValidator
=
passwordPolicyValidator
;
this
.
login
Service
=
loginService
;
this
.
loginHistory
Service
=
loginHistoryService
;
this
.
login
Repository
=
loginRepository
;
this
.
loginHistory
Repository
=
loginHistoryRepository
;
this
.
remeberMeService
=
remeberMeService
;
this
.
jdbcTemplate
=
jdbcTemplate
;
this
.
ldapAuthenticationRealm
=
ldapAuthenticationRealm
;
...
...
@@ -121,14 +122,14 @@ public class JdbcAuthenticationRealm extends AbstractAuthenticationRealm {
if
(!
passwordMatches
)
{
passwordPolicyValidator
.
plusBadPasswordCount
(
userInfo
);
insertLoginHistory
(
userInfo
,
ConstantsLoginType
.
LOCAL
,
""
,
"xe00000004"
,
WebConstants
.
LOGIN_RESULT
.
PASSWORD_ERROE
);
if
(
userInfo
.
getBadPasswordCount
()>=(
passwordPolicy
Validator
.
getPasswordPolicy
()
.
getAttempts
()/
2
))
{
PasswordPolicy
passwordPolicy
=
passwordPolicyValidator
.
getPasswordPolicyRepository
().
getPasswordPolicy
();
if
(
userInfo
.
getBadPasswordCount
()>=(
passwordPolicy
.
getAttempts
()/
2
))
{
throw
new
BadCredentialsException
(
WebContext
.
getI18nValue
(
"login.error.password.attempts"
,
new
Object
[]{
userInfo
.
getBadPasswordCount
()
+
1
,
passwordPolicy
Validator
.
getPasswordPolicy
()
.
getAttempts
(),
passwordPolicy
Validator
.
getPasswordPolicy
()
.
getDuration
()}));
passwordPolicy
.
getAttempts
(),
passwordPolicy
.
getDuration
()}));
}
else
{
throw
new
BadCredentialsException
(
WebContext
.
getI18nValue
(
"login.error.password"
));
}
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/autoconfigure/AuthenticationAutoConfiguration.java
浏览文件 @
e0a274fa
...
...
@@ -27,8 +27,10 @@ import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import
org.maxkey.authn.support.rememberme.RemeberMeServiceFactory
;
import
org.maxkey.configuration.ApplicationConfig
;
import
org.maxkey.password.onetimepwd.AbstractOtpAuthn
;
import
org.maxkey.persistence.db.PasswordPolicyValidator
;
import
org.maxkey.persistence.redis.RedisConnectionFactory
;
import
org.maxkey.persistence.repository.LoginHistoryRepository
;
import
org.maxkey.persistence.repository.LoginRepository
;
import
org.maxkey.persistence.repository.PasswordPolicyValidator
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.InitializingBean
;
...
...
@@ -37,8 +39,6 @@ import org.springframework.context.MessageSource;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.maxkey.persistence.db.LoginService
;
import
org.maxkey.persistence.db.LoginHistoryService
;
@Configuration
...
...
@@ -80,13 +80,13 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
return
new
PasswordPolicyValidator
(
jdbcTemplate
,
messageSource
);
}
@Bean
(
name
=
"login
Service
"
)
public
Login
Service
LoginService
(
JdbcTemplate
jdbcTemplate
)
{
return
new
Login
Service
(
jdbcTemplate
);
@Bean
(
name
=
"login
Repository
"
)
public
Login
Repository
loginRepository
(
JdbcTemplate
jdbcTemplate
)
{
return
new
Login
Repository
(
jdbcTemplate
);
}
@Bean
(
name
=
"loginHistory
Service
"
)
public
LoginHistory
Service
loginHistoryService
(
JdbcTemplate
jdbcTemplate
)
{
return
new
LoginHistory
Service
(
jdbcTemplate
);
@Bean
(
name
=
"loginHistory
Repository
"
)
public
LoginHistory
Repository
LoginHistoryRepository
(
JdbcTemplate
jdbcTemplate
)
{
return
new
LoginHistory
Repository
(
jdbcTemplate
);
}
/**
...
...
maxkey-common/src/main/java/org/maxkey/util/ExcelUtils.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey.util
;
import
java.text.DecimalFormat
;
...
...
maxkey-common/src/test/java/org/maxkey/Copyright.java
浏览文件 @
e0a274fa
...
...
@@ -31,7 +31,7 @@ import java.io.OutputStreamWriter;
*/
public
class
Copyright
{
// 存放java文件的文件夹,必须是文件夹
private
static
String
srcFolder
=
"
C:\\IDES\\shimi\\eclipse-workspace
\\MaxKey"
;
private
static
String
srcFolder
=
"
D:\\MaxKey\\workspace\\workspace-maxkey
\\MaxKey"
;
//已添加标识
private
static
String
copyRightText
=
"http://www.apache.org/licenses/LICENSE-2.0"
;
//扫描目录
...
...
maxkey-common/src/test/java/org/maxkey/Integer2LongTest.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey
;
public
class
Integer2LongTest
{
...
...
maxkey-common/src/test/java/org/maxkey/copyright.txt
浏览文件 @
e0a274fa
/*
* Copyright [202
1
] [MaxKey of copyright http://www.maxkey.top]
* Copyright [202
2
] [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.
...
...
maxkey-common/src/test/java/org/maxkey/util/InstanceTest.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey.util
;
import
java.security.Provider
;
...
...
maxkey-common/src/test/java/org/maxkey/word/RunJavaEnvs.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey.word
;
import
java.util.Iterator
;
...
...
maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java
浏览文件 @
e0a274fa
...
...
@@ -29,8 +29,8 @@ import org.maxkey.crypto.password.MessageDigestPasswordEncoder;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.crypto.password.SM3PasswordEncoder
;
import
org.maxkey.crypto.password.StandardPasswordEncoder
;
import
org.maxkey.persistence.
db.InstitutionService
;
import
org.maxkey.persistence.
db.LocalizationService
;
import
org.maxkey.persistence.
repository.InstitutionsRepository
;
import
org.maxkey.persistence.
repository.LocalizationRepository
;
import
org.maxkey.util.IdGenerator
;
import
org.maxkey.util.SnowFlakeId
;
import
org.maxkey.web.WebContext
;
...
...
@@ -65,14 +65,15 @@ public class ApplicationAutoConfiguration implements InitializingBean {
return
new
DataSourceTransactionManager
(
dataSource
);
}
@Bean
(
name
=
"institution
Service
"
)
public
Institution
Service
institutionService
(
JdbcTemplate
jdbcTemplate
)
{
return
new
Institution
Service
(
jdbcTemplate
);
@Bean
(
name
=
"institution
sRepository
"
)
public
Institution
sRepository
InstitutionsRepository
(
JdbcTemplate
jdbcTemplate
)
{
return
new
Institution
sRepository
(
jdbcTemplate
);
}
@Bean
(
name
=
"localizationService"
)
public
LocalizationService
localizationService
(
JdbcTemplate
jdbcTemplate
,
InstitutionService
institutionService
)
{
return
new
LocalizationService
(
jdbcTemplate
,
institutionService
);
@Bean
(
name
=
"localizationRepository"
)
public
LocalizationRepository
localizationRepository
(
JdbcTemplate
jdbcTemplate
,
InstitutionsRepository
institutionsRepository
)
{
return
new
LocalizationRepository
(
jdbcTemplate
,
institutionsRepository
);
}
/**
...
...
maxkey-core/src/main/java/org/maxkey/autoconfigure/MvcAutoConfiguration.java
浏览文件 @
e0a274fa
...
...
@@ -24,9 +24,9 @@ import javax.servlet.Filter;
import
org.maxkey.configuration.ApplicationConfig
;
import
org.maxkey.constants.ConstantsTimeInterval
;
import
org.maxkey.persistence.
db.InstitutionService
;
import
org.maxkey.persistence.
db.LoginHistoryService
;
import
org.maxkey.persistence.
db.LoginService
;
import
org.maxkey.persistence.
repository.InstitutionsRepository
;
import
org.maxkey.persistence.
repository.LoginHistoryRepository
;
import
org.maxkey.persistence.
repository.LoginRepository
;
import
org.maxkey.web.SessionListenerAdapter
;
import
org.maxkey.web.WebXssRequestFilter
;
import
org.maxkey.web.WebInstRequestFilter
;
...
...
@@ -284,11 +284,11 @@ public class MvcAutoConfiguration implements InitializingBean , WebMvcConfigurer
@Bean
public
FilterRegistrationBean
<
Filter
>
WebInstRequestFilter
(
Institution
Service
institutionService
,
Institution
sRepository
institutionsRepository
,
ApplicationConfig
applicationConfig
)
{
_logger
.
debug
(
"WebInstRequestFilter init for /* "
);
FilterRegistrationBean
<
Filter
>
registrationBean
=
new
FilterRegistrationBean
<
Filter
>(
new
WebInstRequestFilter
(
institution
Service
,
applicationConfig
));
new
FilterRegistrationBean
<
Filter
>(
new
WebInstRequestFilter
(
institution
sRepository
,
applicationConfig
));
registrationBean
.
addUrlPatterns
(
"/*"
);
registrationBean
.
setName
(
"webInstRequestFilter"
);
registrationBean
.
setOrder
(
3
);
...
...
@@ -297,11 +297,11 @@ public class MvcAutoConfiguration implements InitializingBean , WebMvcConfigurer
@Bean
(
name
=
"sessionListenerAdapter"
)
public
SessionListenerAdapter
sessionListenerAdapter
(
Login
Service
loginService
,
LoginHistory
Service
loginHistoryService
Login
Repository
loginRepository
,
LoginHistory
Repository
loginHistoryRepository
)
{
SessionListenerAdapter
sessionListenerAdapter
=
new
SessionListenerAdapter
(
login
Service
,
loginHistoryService
);
new
SessionListenerAdapter
(
login
Repository
,
loginHistoryRepository
);
return
sessionListenerAdapter
;
}
...
...
maxkey-core/src/main/java/org/maxkey/entity/LdapContext.java
0 → 100644
浏览文件 @
e0a274fa
/*
* 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.
*/
package
org.maxkey.entity
;
import
java.io.Serializable
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
org.apache.mybatis.jpa.persistence.JpaBaseEntity
;
@Entity
@Table
(
name
=
"MXK_LDAP_CONTEXT"
)
public
class
LdapContext
extends
JpaBaseEntity
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
-
4595539647817265938L
;
@Id
@Column
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
,
generator
=
"snowflakeid"
)
String
id
;
@Column
String
product
;
@Column
String
providerUrl
;
@Column
String
principal
;
@Column
String
credentials
;
@Column
String
filters
;
@Column
String
basedn
;
@Column
String
msadDomain
;
@Column
String
sslSwitch
;
@Column
String
trustStore
;
@Column
String
trustStorePassword
;
@Column
String
description
;
@Column
String
createdBy
;
@Column
String
createdDate
;
@Column
String
modifiedBy
;
@Column
String
modifiedDate
;
@Column
int
status
;
@Column
private
String
instId
;
private
String
instName
;
public
LdapContext
()
{
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getProduct
()
{
return
product
;
}
public
void
setProduct
(
String
product
)
{
this
.
product
=
product
;
}
public
String
getProviderUrl
()
{
return
providerUrl
;
}
public
void
setProviderUrl
(
String
providerUrl
)
{
this
.
providerUrl
=
providerUrl
;
}
public
String
getPrincipal
()
{
return
principal
;
}
public
void
setPrincipal
(
String
principal
)
{
this
.
principal
=
principal
;
}
public
String
getCredentials
()
{
return
credentials
;
}
public
void
setCredentials
(
String
credentials
)
{
this
.
credentials
=
credentials
;
}
public
String
getFilters
()
{
return
filters
;
}
public
void
setFilters
(
String
filters
)
{
this
.
filters
=
filters
;
}
public
String
getBasedn
()
{
return
basedn
;
}
public
void
setBasedn
(
String
basedn
)
{
this
.
basedn
=
basedn
;
}
public
String
getMsadDomain
()
{
return
msadDomain
;
}
public
void
setMsadDomain
(
String
msadDomain
)
{
this
.
msadDomain
=
msadDomain
;
}
public
String
getSslSwitch
()
{
return
sslSwitch
;
}
public
void
setSslSwitch
(
String
sslSwitch
)
{
this
.
sslSwitch
=
sslSwitch
;
}
public
String
getTrustStore
()
{
return
trustStore
;
}
public
void
setTrustStore
(
String
trustStore
)
{
this
.
trustStore
=
trustStore
;
}
public
String
getTrustStorePassword
()
{
return
trustStorePassword
;
}
public
void
setTrustStorePassword
(
String
trustStorePassword
)
{
this
.
trustStorePassword
=
trustStorePassword
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getCreatedBy
()
{
return
createdBy
;
}
public
void
setCreatedBy
(
String
createdBy
)
{
this
.
createdBy
=
createdBy
;
}
public
String
getCreatedDate
()
{
return
createdDate
;
}
public
void
setCreatedDate
(
String
createdDate
)
{
this
.
createdDate
=
createdDate
;
}
public
String
getModifiedBy
()
{
return
modifiedBy
;
}
public
void
setModifiedBy
(
String
modifiedBy
)
{
this
.
modifiedBy
=
modifiedBy
;
}
public
String
getModifiedDate
()
{
return
modifiedDate
;
}
public
void
setModifiedDate
(
String
modifiedDate
)
{
this
.
modifiedDate
=
modifiedDate
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
String
getInstId
()
{
return
instId
;
}
public
void
setInstId
(
String
instId
)
{
this
.
instId
=
instId
;
}
public
String
getInstName
()
{
return
instName
;
}
public
void
setInstName
(
String
instName
)
{
this
.
instName
=
instName
;
}
@Override
public
String
toString
()
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"LdapContext [id="
);
builder
.
append
(
id
);
builder
.
append
(
", product="
);
builder
.
append
(
product
);
builder
.
append
(
", providerUrl="
);
builder
.
append
(
providerUrl
);
builder
.
append
(
", principal="
);
builder
.
append
(
principal
);
builder
.
append
(
", credentials="
);
builder
.
append
(
credentials
);
builder
.
append
(
", filters="
);
builder
.
append
(
filters
);
builder
.
append
(
", basedn="
);
builder
.
append
(
basedn
);
builder
.
append
(
", msadDomain="
);
builder
.
append
(
msadDomain
);
builder
.
append
(
", sslSwitch="
);
builder
.
append
(
sslSwitch
);
builder
.
append
(
", trustStore="
);
builder
.
append
(
trustStore
);
builder
.
append
(
", trustStorePassword="
);
builder
.
append
(
trustStorePassword
);
builder
.
append
(
", description="
);
builder
.
append
(
description
);
builder
.
append
(
", createdBy="
);
builder
.
append
(
createdBy
);
builder
.
append
(
", createdDate="
);
builder
.
append
(
createdDate
);
builder
.
append
(
", modifiedBy="
);
builder
.
append
(
modifiedBy
);
builder
.
append
(
", modifiedDate="
);
builder
.
append
(
modifiedDate
);
builder
.
append
(
", status="
);
builder
.
append
(
status
);
builder
.
append
(
", instId="
);
builder
.
append
(
instId
);
builder
.
append
(
", instName="
);
builder
.
append
(
instName
);
builder
.
append
(
"]"
);
return
builder
.
toString
();
}
}
maxkey-core/src/main/java/org/maxkey/entity/Localization.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey.entity
;
import
java.io.Serializable
;
...
...
maxkey-core/src/main/java/org/maxkey/persistence/
db/InstitutionService
.java
→
maxkey-core/src/main/java/org/maxkey/persistence/
repository/InstitutionsRepository
.java
浏览文件 @
e0a274fa
...
...
@@ -15,7 +15,7 @@
*/
package
org.maxkey.persistence.
db
;
package
org.maxkey.persistence.
repository
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
...
...
@@ -34,8 +34,8 @@ import org.springframework.jdbc.core.RowMapper;
import
com.github.benmanes.caffeine.cache.Cache
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
public
class
Institution
Service
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
Institution
Service
.
class
);
public
class
Institution
sRepository
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
Institution
sRepository
.
class
);
private
static
final
String
SELECT_STATEMENT
=
"select * from mxk_institutions where domain = ? and status = "
+
ConstantsStatus
.
ACTIVE
;
...
...
@@ -53,7 +53,7 @@ public class InstitutionService {
protected
JdbcTemplate
jdbcTemplate
;
public
Institution
Service
(
JdbcTemplate
jdbcTemplate
)
{
public
Institution
sRepository
(
JdbcTemplate
jdbcTemplate
)
{
this
.
jdbcTemplate
=
jdbcTemplate
;
}
...
...
maxkey-core/src/main/java/org/maxkey/persistence/
db/LocalizationService
.java
→
maxkey-core/src/main/java/org/maxkey/persistence/
repository/LocalizationRepository
.java
浏览文件 @
e0a274fa
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.maxkey.persistence.
db
;
package
org.maxkey.persistence.
repository
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
...
...
@@ -33,8 +33,8 @@ import org.springframework.jdbc.core.RowMapper;
import
com.github.benmanes.caffeine.cache.Cache
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
public
class
Localization
Service
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
Localization
Service
.
class
);
public
class
Localization
Repository
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
Localization
Repository
.
class
);
private
static
final
String
INSERT_STATEMENT
=
"insert into mxk_localization (id, property,langzh,langen,status,description,instid)values(?,?,?,?,?,?,?)"
;
private
static
final
String
UPDATE_STATEMENT
=
"update mxk_localization set langzh = ? , langen =? where id = ?"
;
private
static
final
String
DELETE_STATEMENT
=
"delete from mxk_localization where id = ?"
;
...
...
@@ -42,7 +42,7 @@ public class LocalizationService {
private
static
final
Pattern
PATTERN_HTML
=
Pattern
.
compile
(
"<[^>]+>"
,
Pattern
.
CASE_INSENSITIVE
);
protected
Institution
Service
institutionService
;
protected
Institution
sRepository
institutionService
;
JdbcTemplate
jdbcTemplate
;
...
...
@@ -51,7 +51,7 @@ public class LocalizationService {
.
expireAfterWrite
(
ConstantsTimeInterval
.
ONE_HOUR
,
TimeUnit
.
SECONDS
)
.
build
();
public
Localization
Service
()
{
public
Localization
Repository
()
{
}
...
...
@@ -102,7 +102,7 @@ public class LocalizationService {
return
message
;
}
public
void
setInstitutionService
(
Institution
Service
institutionService
)
{
public
void
setInstitutionService
(
Institution
sRepository
institutionService
)
{
this
.
institutionService
=
institutionService
;
}
...
...
@@ -133,7 +133,7 @@ public class LocalizationService {
return
(
localizations
==
null
||
localizations
.
size
()==
0
)
?
null
:
localizations
.
get
(
0
);
}
public
Localization
Service
(
JdbcTemplate
jdbcTemplate
,
InstitutionService
institutionService
)
{
public
Localization
Repository
(
JdbcTemplate
jdbcTemplate
,
InstitutionsRepository
institutionService
)
{
super
();
this
.
institutionService
=
institutionService
;
this
.
jdbcTemplate
=
jdbcTemplate
;
...
...
maxkey-core/src/main/java/org/maxkey/persistence/
db/LoginHistoryService
.java
→
maxkey-core/src/main/java/org/maxkey/persistence/
repository/LoginHistoryRepository
.java
浏览文件 @
e0a274fa
...
...
@@ -15,7 +15,7 @@
*/
package
org.maxkey.persistence.
db
;
package
org.maxkey.persistence.
repository
;
import
java.sql.Types
;
...
...
@@ -25,8 +25,8 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
public
class
LoginHistory
Service
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
LoginHistory
Service
.
class
);
public
class
LoginHistory
Repository
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
LoginHistory
Repository
.
class
);
private
static
final
String
HISTORY_LOGIN_INSERT_STATEMENT
=
"insert into mxk_history_login (id , sessionid , userid , username , displayname , logintype , message , code , provider , sourceip , browser , platform , application , loginurl , sessionstatus ,instid)values( ? , ? , ? , ? , ? , ? , ?, ? , ? , ?, ? , ? , ?, ? , ? , ?)"
;
...
...
@@ -34,7 +34,7 @@ public class LoginHistoryService {
protected
JdbcTemplate
jdbcTemplate
;
public
LoginHistory
Service
(
JdbcTemplate
jdbcTemplate
)
{
public
LoginHistory
Repository
(
JdbcTemplate
jdbcTemplate
)
{
this
.
jdbcTemplate
=
jdbcTemplate
;
}
...
...
maxkey-core/src/main/java/org/maxkey/persistence/
db/LoginService
.java
→
maxkey-core/src/main/java/org/maxkey/persistence/
repository/LoginRepository
.java
浏览文件 @
e0a274fa
...
...
@@ -15,7 +15,7 @@
*/
package
org.maxkey.persistence.
db
;
package
org.maxkey.persistence.
repository
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
...
...
@@ -35,8 +35,8 @@ import org.springframework.jdbc.core.RowMapper;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
public
class
Login
Service
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
Login
Service
.
class
);
public
class
Login
Repository
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
Login
Repository
.
class
);
private
static
final
String
LOCK_USER_UPDATE_STATEMENT
=
"update mxk_userinfo set islocked = ? , unlocktime = ? where id = ?"
;
...
...
@@ -69,11 +69,11 @@ public class LoginService {
*/
public
static
int
LOGIN_ATTRIBUTE_TYPE
=
2
;
public
Login
Service
(){
public
Login
Repository
(){
}
public
Login
Service
(
JdbcTemplate
jdbcTemplate
){
public
Login
Repository
(
JdbcTemplate
jdbcTemplate
){
this
.
jdbcTemplate
=
jdbcTemplate
;
}
...
...
maxkey-core/src/main/java/org/maxkey/persistence/
db
/PasswordPolicyMessageResolver.java
→
maxkey-core/src/main/java/org/maxkey/persistence/
repository
/PasswordPolicyMessageResolver.java
浏览文件 @
e0a274fa
...
...
@@ -15,7 +15,7 @@
*/
package
org.maxkey.persistence.
db
;
package
org.maxkey.persistence.
repository
;
import
java.util.Locale
;
...
...
maxkey-core/src/main/java/org/maxkey/persistence/repository/PasswordPolicyRepository.java
0 → 100644
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey.persistence.repository
;
import
java.io.InputStreamReader
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.concurrent.TimeUnit
;
import
org.maxkey.constants.ConstantsProperties
;
import
org.maxkey.entity.PasswordPolicy
;
import
org.passay.CharacterOccurrencesRule
;
import
org.passay.CharacterRule
;
import
org.passay.DictionaryRule
;
import
org.passay.EnglishCharacterData
;
import
org.passay.EnglishSequenceData
;
import
org.passay.IllegalSequenceRule
;
import
org.passay.LengthRule
;
import
org.passay.Rule
;
import
org.passay.UsernameRule
;
import
org.passay.WhitespaceRule
;
import
org.passay.dictionary.Dictionary
;
import
org.passay.dictionary.DictionaryBuilder
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
import
com.github.benmanes.caffeine.cache.Cache
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
public
class
PasswordPolicyRepository
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
PasswordPolicyRepository
.
class
);
//Dictionary topWeakPassword Source
public
static
final
String
topWeakPasswordPropertySource
=
"classpath:/top_weak_password.txt"
;
//Cache PasswordPolicy in memory ONE_HOUR
protected
static
final
Cache
<
String
,
PasswordPolicy
>
passwordPolicyStore
=
Caffeine
.
newBuilder
()
.
expireAfterWrite
(
60
,
TimeUnit
.
MINUTES
)
.
build
();
protected
PasswordPolicy
passwordPolicy
;
protected
JdbcTemplate
jdbcTemplate
;
ArrayList
<
Rule
>
passwordPolicyRuleList
;
private
static
final
String
PASSWORD_POLICY_KEY
=
"PASSWORD_POLICY_KEY"
;
private
static
final
String
PASSWORD_POLICY_SELECT_STATEMENT
=
"select * from mxk_password_policy "
;
public
PasswordPolicyRepository
(
JdbcTemplate
jdbcTemplate
)
{
this
.
jdbcTemplate
=
jdbcTemplate
;
}
/**
* init PasswordPolicy and load Rules
* @return
*/
public
PasswordPolicy
getPasswordPolicy
()
{
passwordPolicy
=
passwordPolicyStore
.
getIfPresent
(
PASSWORD_POLICY_KEY
);
if
(
passwordPolicy
==
null
)
{
passwordPolicy
=
jdbcTemplate
.
queryForObject
(
PASSWORD_POLICY_SELECT_STATEMENT
,
new
PasswordPolicyRowMapper
());
_logger
.
debug
(
"query PasswordPolicy : "
+
passwordPolicy
);
passwordPolicyStore
.
put
(
PASSWORD_POLICY_KEY
,
passwordPolicy
);
//RandomPasswordLength =(MaxLength +MinLength)/2
passwordPolicy
.
setRandomPasswordLength
(
Math
.
round
(
(
passwordPolicy
.
getMaxLength
()
+
passwordPolicy
.
getMinLength
()
)/
2
)
);
passwordPolicyRuleList
=
new
ArrayList
<
Rule
>();
passwordPolicyRuleList
.
add
(
new
WhitespaceRule
());
passwordPolicyRuleList
.
add
(
new
LengthRule
(
passwordPolicy
.
getMinLength
(),
passwordPolicy
.
getMaxLength
()));
if
(
passwordPolicy
.
getUpperCase
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterRule
(
EnglishCharacterData
.
UpperCase
,
passwordPolicy
.
getUpperCase
()));
}
if
(
passwordPolicy
.
getLowerCase
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterRule
(
EnglishCharacterData
.
LowerCase
,
passwordPolicy
.
getLowerCase
()));
}
if
(
passwordPolicy
.
getDigits
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterRule
(
EnglishCharacterData
.
Digit
,
passwordPolicy
.
getDigits
()));
}
if
(
passwordPolicy
.
getSpecialChar
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterRule
(
EnglishCharacterData
.
Special
,
passwordPolicy
.
getSpecialChar
()));
}
if
(
passwordPolicy
.
getUsername
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
UsernameRule
());
}
if
(
passwordPolicy
.
getOccurances
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterOccurrencesRule
(
passwordPolicy
.
getOccurances
()));
}
if
(
passwordPolicy
.
getAlphabetical
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
IllegalSequenceRule
(
EnglishSequenceData
.
Alphabetical
,
4
,
false
));
}
if
(
passwordPolicy
.
getNumerical
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
IllegalSequenceRule
(
EnglishSequenceData
.
Numerical
,
4
,
false
));
}
if
(
passwordPolicy
.
getQwerty
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
IllegalSequenceRule
(
EnglishSequenceData
.
USQwerty
,
4
,
false
));
}
if
(
passwordPolicy
.
getDictionary
()>
0
)
{
try
{
ClassPathResource
dictFile
=
new
ClassPathResource
(
ConstantsProperties
.
classPathResource
(
topWeakPasswordPropertySource
));
Dictionary
dictionary
=
new
DictionaryBuilder
().
addReader
(
new
InputStreamReader
(
dictFile
.
getInputStream
())).
build
();
passwordPolicyRuleList
.
add
(
new
DictionaryRule
(
dictionary
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
return
passwordPolicy
;
}
public
ArrayList
<
Rule
>
getPasswordPolicyRuleList
()
{
return
passwordPolicyRuleList
;
}
public
class
PasswordPolicyRowMapper
implements
RowMapper
<
PasswordPolicy
>
{
@Override
public
PasswordPolicy
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
PasswordPolicy
passwordPolicy
=
new
PasswordPolicy
();
passwordPolicy
.
setId
(
rs
.
getString
(
"ID"
));
passwordPolicy
.
setMinLength
(
rs
.
getInt
(
"MINLENGTH"
));
passwordPolicy
.
setMaxLength
(
rs
.
getInt
(
"MAXLENGTH"
));
passwordPolicy
.
setLowerCase
(
rs
.
getInt
(
"LOWERCASE"
));
passwordPolicy
.
setUpperCase
(
rs
.
getInt
(
"UPPERCASE"
));
passwordPolicy
.
setDigits
(
rs
.
getInt
(
"DIGITS"
));
passwordPolicy
.
setSpecialChar
(
rs
.
getInt
(
"SPECIALCHAR"
));
passwordPolicy
.
setAttempts
(
rs
.
getInt
(
"ATTEMPTS"
));
passwordPolicy
.
setDuration
(
rs
.
getInt
(
"DURATION"
));
passwordPolicy
.
setExpiration
(
rs
.
getInt
(
"EXPIRATION"
));
passwordPolicy
.
setUsername
(
rs
.
getInt
(
"USERNAME"
));
passwordPolicy
.
setHistory
(
rs
.
getInt
(
"HISTORY"
));
passwordPolicy
.
setDictionary
(
rs
.
getInt
(
"DICTIONARY"
));
passwordPolicy
.
setAlphabetical
(
rs
.
getInt
(
"ALPHABETICAL"
));
passwordPolicy
.
setNumerical
(
rs
.
getInt
(
"NUMERICAL"
));
passwordPolicy
.
setQwerty
(
rs
.
getInt
(
"QWERTY"
));
passwordPolicy
.
setOccurances
(
rs
.
getInt
(
"OCCURANCES"
));
return
passwordPolicy
;
}
}
}
maxkey-core/src/main/java/org/maxkey/persistence/
db
/PasswordPolicyValidator.java
→
maxkey-core/src/main/java/org/maxkey/persistence/
repository
/PasswordPolicyValidator.java
浏览文件 @
e0a274fa
...
...
@@ -15,21 +15,14 @@
*/
package
org.maxkey.persistence.
db
;
package
org.maxkey.persistence.
repository
;
import
java.io.InputStreamReader
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Types
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
import
org.joda.time.DateTime
;
import
org.joda.time.Duration
;
import
org.joda.time.format.DateTimeFormat
;
import
org.maxkey.constants.ConstantsPasswordSetType
;
import
org.maxkey.constants.ConstantsProperties
;
import
org.maxkey.constants.ConstantsStatus
;
import
org.maxkey.crypto.password.PasswordGen
;
import
org.maxkey.entity.PasswordPolicy
;
...
...
@@ -37,48 +30,19 @@ import org.maxkey.entity.UserInfo;
import
org.maxkey.util.StringUtils
;
import
org.maxkey.web.WebConstants
;
import
org.maxkey.web.WebContext
;
import
org.passay.CharacterOccurrencesRule
;
import
org.passay.CharacterRule
;
import
org.passay.DictionaryRule
;
import
org.passay.EnglishCharacterData
;
import
org.passay.EnglishSequenceData
;
import
org.passay.IllegalSequenceRule
;
import
org.passay.LengthRule
;
import
org.passay.PasswordData
;
import
org.passay.PasswordValidator
;
import
org.passay.Rule
;
import
org.passay.RuleResult
;
import
org.passay.UsernameRule
;
import
org.passay.WhitespaceRule
;
import
org.passay.dictionary.Dictionary
;
import
org.passay.dictionary.DictionaryBuilder
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.context.MessageSource
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
com.github.benmanes.caffeine.cache.Cache
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
public
class
PasswordPolicyValidator
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
PasswordPolicyValidator
.
class
);
//Dictionary topWeakPassword Source
public
static
final
String
topWeakPasswordPropertySource
=
"classpath:/top_weak_password.txt"
;
//Cache PasswordPolicy in memory ONE_HOUR
protected
static
final
Cache
<
String
,
PasswordPolicy
>
passwordPolicyStore
=
Caffeine
.
newBuilder
()
.
expireAfterWrite
(
60
,
TimeUnit
.
MINUTES
)
.
build
();
protected
PasswordPolicy
passwordPolicy
;
ArrayList
<
Rule
>
passwordPolicyRuleList
;
PasswordPolicyRepository
passwordPolicyRepository
;
protected
JdbcTemplate
jdbcTemplate
;
...
...
@@ -86,12 +50,8 @@ public class PasswordPolicyValidator {
public
static
final
String
PASSWORD_POLICY_VALIDATE_RESULT
=
"PASSWORD_POLICY_SESSION_VALIDATE_RESULT_KEY"
;
private
static
final
String
PASSWORD_POLICY_KEY
=
"PASSWORD_POLICY_KEY"
;
private
static
final
String
LOCK_USER_UPDATE_STATEMENT
=
"update mxk_userinfo set islocked = ? , unlocktime = ? where id = ?"
;
private
static
final
String
PASSWORD_POLICY_SELECT_STATEMENT
=
"select * from mxk_password_policy "
;
private
static
final
String
UNLOCK_USER_UPDATE_STATEMENT
=
"update mxk_userinfo set islocked = ? , unlocktime = ? where id = ?"
;
private
static
final
String
BADPASSWORDCOUNT_UPDATE_STATEMENT
=
"update mxk_userinfo set badpasswordcount = ? , badpasswordtime = ? where id = ?"
;
...
...
@@ -104,84 +64,8 @@ public class PasswordPolicyValidator {
public
PasswordPolicyValidator
(
JdbcTemplate
jdbcTemplate
,
MessageSource
messageSource
)
{
this
.
messageSource
=
messageSource
;
this
.
jdbcTemplate
=
jdbcTemplate
;
}
/**
* init PasswordPolicy and load Rules
* @return
*/
public
PasswordPolicy
getPasswordPolicy
()
{
passwordPolicy
=
passwordPolicyStore
.
getIfPresent
(
PASSWORD_POLICY_KEY
);
if
(
passwordPolicy
==
null
)
{
passwordPolicy
=
jdbcTemplate
.
queryForObject
(
PASSWORD_POLICY_SELECT_STATEMENT
,
new
PasswordPolicyRowMapper
());
_logger
.
debug
(
"query PasswordPolicy : "
+
passwordPolicy
);
passwordPolicyStore
.
put
(
PASSWORD_POLICY_KEY
,
passwordPolicy
);
//RandomPasswordLength =(MaxLength +MinLength)/2
passwordPolicy
.
setRandomPasswordLength
(
Math
.
round
(
(
passwordPolicy
.
getMaxLength
()
+
passwordPolicy
.
getMinLength
()
)/
2
)
);
passwordPolicyRuleList
=
new
ArrayList
<
Rule
>();
passwordPolicyRuleList
.
add
(
new
WhitespaceRule
());
passwordPolicyRuleList
.
add
(
new
LengthRule
(
passwordPolicy
.
getMinLength
(),
passwordPolicy
.
getMaxLength
()));
if
(
passwordPolicy
.
getUpperCase
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterRule
(
EnglishCharacterData
.
UpperCase
,
passwordPolicy
.
getUpperCase
()));
}
if
(
passwordPolicy
.
getLowerCase
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterRule
(
EnglishCharacterData
.
LowerCase
,
passwordPolicy
.
getLowerCase
()));
}
if
(
passwordPolicy
.
getDigits
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterRule
(
EnglishCharacterData
.
Digit
,
passwordPolicy
.
getDigits
()));
}
if
(
passwordPolicy
.
getSpecialChar
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterRule
(
EnglishCharacterData
.
Special
,
passwordPolicy
.
getSpecialChar
()));
}
if
(
passwordPolicy
.
getUsername
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
UsernameRule
());
}
if
(
passwordPolicy
.
getOccurances
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
CharacterOccurrencesRule
(
passwordPolicy
.
getOccurances
()));
}
if
(
passwordPolicy
.
getAlphabetical
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
IllegalSequenceRule
(
EnglishSequenceData
.
Alphabetical
,
4
,
false
));
}
if
(
passwordPolicy
.
getNumerical
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
IllegalSequenceRule
(
EnglishSequenceData
.
Numerical
,
4
,
false
));
}
if
(
passwordPolicy
.
getQwerty
()>
0
)
{
passwordPolicyRuleList
.
add
(
new
IllegalSequenceRule
(
EnglishSequenceData
.
USQwerty
,
4
,
false
));
}
if
(
passwordPolicy
.
getDictionary
()>
0
)
{
try
{
ClassPathResource
dictFile
=
new
ClassPathResource
(
ConstantsProperties
.
classPathResource
(
topWeakPasswordPropertySource
));
Dictionary
dictionary
=
new
DictionaryBuilder
().
addReader
(
new
InputStreamReader
(
dictFile
.
getInputStream
())).
build
();
passwordPolicyRuleList
.
add
(
new
DictionaryRule
(
dictionary
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
return
passwordPolicy
;
this
.
passwordPolicyRepository
=
new
PasswordPolicyRepository
(
jdbcTemplate
);
}
/**
...
...
@@ -200,10 +84,8 @@ public class PasswordPolicyValidator {
return
false
;
}
getPasswordPolicy
();
PasswordValidator
validator
=
new
PasswordValidator
(
new
PasswordPolicyMessageResolver
(
messageSource
),
passwordPolicyR
uleList
);
new
PasswordPolicyMessageResolver
(
messageSource
),
passwordPolicyR
epository
.
getPasswordPolicyRuleList
()
);
RuleResult
result
=
validator
.
validate
(
new
PasswordData
(
username
,
password
));
...
...
@@ -230,8 +112,8 @@ public class PasswordPolicyValidator {
*/
public
boolean
passwordPolicyValid
(
UserInfo
userInfo
)
{
getPasswordPolicy
();
PasswordPolicy
passwordPolicy
=
passwordPolicyRepository
.
getPasswordPolicy
();
DateTime
currentdateTime
=
new
DateTime
();
/*
* check login attempts fail times
...
...
@@ -285,7 +167,8 @@ public class PasswordPolicyValidator {
}
public
void
applyPasswordPolicy
(
UserInfo
userInfo
)
{
getPasswordPolicy
();
PasswordPolicy
passwordPolicy
=
passwordPolicyRepository
.
getPasswordPolicy
();
DateTime
currentdateTime
=
new
DateTime
();
//initial password need change
if
(
userInfo
.
getLoginCount
()<=
0
)
{
...
...
@@ -417,7 +300,8 @@ public class PasswordPolicyValidator {
}
public
String
generateRandomPassword
()
{
getPasswordPolicy
();
PasswordPolicy
passwordPolicy
=
passwordPolicyRepository
.
getPasswordPolicy
();
PasswordGen
passwordGen
=
new
PasswordGen
(
passwordPolicy
.
getRandomPasswordLength
()
);
...
...
@@ -428,36 +312,9 @@ public class PasswordPolicyValidator {
passwordPolicy
.
getDigits
(),
passwordPolicy
.
getSpecialChar
());
}
public
void
setPasswordPolicy
(
PasswordPolicy
passwordPolicy
)
{
this
.
passwordPolicy
=
passwordPolicy
;
}
public
class
PasswordPolicyRowMapper
implements
RowMapper
<
PasswordPolicy
>
{
public
PasswordPolicyRepository
getPasswordPolicyRepository
()
{
return
passwordPolicyRepository
;
}
@Override
public
PasswordPolicy
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
PasswordPolicy
passwordPolicy
=
new
PasswordPolicy
();
passwordPolicy
.
setId
(
rs
.
getString
(
"ID"
));
passwordPolicy
.
setMinLength
(
rs
.
getInt
(
"MINLENGTH"
));
passwordPolicy
.
setMaxLength
(
rs
.
getInt
(
"MAXLENGTH"
));
passwordPolicy
.
setLowerCase
(
rs
.
getInt
(
"LOWERCASE"
));
passwordPolicy
.
setUpperCase
(
rs
.
getInt
(
"UPPERCASE"
));
passwordPolicy
.
setDigits
(
rs
.
getInt
(
"DIGITS"
));
passwordPolicy
.
setSpecialChar
(
rs
.
getInt
(
"SPECIALCHAR"
));
passwordPolicy
.
setAttempts
(
rs
.
getInt
(
"ATTEMPTS"
));
passwordPolicy
.
setDuration
(
rs
.
getInt
(
"DURATION"
));
passwordPolicy
.
setExpiration
(
rs
.
getInt
(
"EXPIRATION"
));
passwordPolicy
.
setUsername
(
rs
.
getInt
(
"USERNAME"
));
passwordPolicy
.
setHistory
(
rs
.
getInt
(
"HISTORY"
));
passwordPolicy
.
setDictionary
(
rs
.
getInt
(
"DICTIONARY"
));
passwordPolicy
.
setAlphabetical
(
rs
.
getInt
(
"ALPHABETICAL"
));
passwordPolicy
.
setNumerical
(
rs
.
getInt
(
"NUMERICAL"
));
passwordPolicy
.
setQwerty
(
rs
.
getInt
(
"QWERTY"
));
passwordPolicy
.
setOccurances
(
rs
.
getInt
(
"OCCURANCES"
));
return
passwordPolicy
;
}
}
}
maxkey-core/src/main/java/org/maxkey/web/SessionListenerAdapter.java
浏览文件 @
e0a274fa
...
...
@@ -24,8 +24,8 @@ import javax.servlet.http.HttpSessionListener;
import
org.apache.mybatis.jpa.util.WebContext
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.
db.LoginHistoryService
;
import
org.maxkey.persistence.
db.LoginService
;
import
org.maxkey.persistence.
repository.LoginHistoryRepository
;
import
org.maxkey.persistence.
repository.LoginRepository
;
import
org.maxkey.util.DateUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -35,26 +35,26 @@ public class SessionListenerAdapter implements HttpSessionListener {
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
SessionListenerAdapter
.
class
);
Login
Service
loginService
;
Login
Repository
loginRepository
;
LoginHistory
Service
loginHistoryService
;
LoginHistory
Repository
loginHistoryRepository
;
public
SessionListenerAdapter
()
{
super
();
_logger
.
debug
(
"SessionListenerAdapter inited . "
);
}
public
SessionListenerAdapter
(
Login
Service
loginService
,
LoginHistoryService
loginHistoryService
)
{
public
SessionListenerAdapter
(
Login
Repository
loginRepository
,
LoginHistoryRepository
loginHistoryRepository
)
{
super
();
this
.
login
Service
=
loginService
;
this
.
loginHistory
Service
=
loginHistoryService
;
this
.
login
Repository
=
loginRepository
;
this
.
loginHistory
Repository
=
loginHistoryRepository
;
_logger
.
debug
(
"SessionListenerAdapter inited . "
);
}
public
void
init
()
{
if
(
login
Service
==
null
)
{
loginService
=
(
LoginService
)
WebContext
.
getBean
(
"loginService
"
);
loginHistoryService
=
(
LoginHistoryService
)
WebContext
.
getBean
(
"loginHistoryService
"
);
if
(
login
Repository
==
null
)
{
loginRepository
=
(
LoginRepository
)
WebContext
.
getBean
(
"loginRepository
"
);
loginHistoryRepository
=
(
LoginHistoryRepository
)
WebContext
.
getBean
(
"loginHistoryRepository
"
);
_logger
.
debug
(
"SessionListenerAdapter function inited . "
);
}
}
...
...
@@ -78,8 +78,8 @@ public class SessionListenerAdapter implements HttpSessionListener {
init
();
UserInfo
userInfo
=
(
UserInfo
)
session
.
getAttribute
(
WebConstants
.
CURRENT_USER
);
userInfo
.
setLastLogoffTime
(
DateUtils
.
formatDateTime
(
new
Date
()));
login
Service
.
updateLastLogoff
(
userInfo
);
loginHistory
Service
.
logoff
(
userInfo
.
getLastLogoffTime
(),
sessionIdAttribute
.
toString
());
login
Repository
.
updateLastLogoff
(
userInfo
);
loginHistory
Repository
.
logoff
(
userInfo
.
getLastLogoffTime
(),
sessionIdAttribute
.
toString
());
_logger
.
debug
(
"session {} Destroyed as {} userId : {} , username : {}"
,
...
...
@@ -91,12 +91,12 @@ public class SessionListenerAdapter implements HttpSessionListener {
}
public
void
setLoginService
(
LoginService
loginService
)
{
this
.
loginService
=
loginService
;
}
public
void
setLoginRepository
(
LoginRepository
loginRepository
)
{
this
.
loginRepository
=
loginRepository
;
}
public
void
setLoginHistoryService
(
LoginHistoryService
loginHistoryService
)
{
this
.
loginHistoryService
=
loginHistoryService
;
}
public
void
setLoginHistoryRepository
(
LoginHistoryRepository
loginHistoryRepository
)
{
this
.
loginHistoryRepository
=
loginHistoryRepository
;
}
}
maxkey-core/src/main/java/org/maxkey/web/WebInstRequestFilter.java
浏览文件 @
e0a274fa
...
...
@@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import
org.apache.commons.lang3.StringUtils
;
import
org.maxkey.configuration.ApplicationConfig
;
import
org.maxkey.entity.Institutions
;
import
org.maxkey.persistence.
db.InstitutionService
;
import
org.maxkey.persistence.
repository.InstitutionsRepository
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.filter.GenericFilterBean
;
...
...
@@ -39,7 +39,7 @@ public class WebInstRequestFilter extends GenericFilterBean {
public
final
static
String
HEADER_HOST
=
"host"
;
Institution
Service
institutionService
;
Institution
sRepository
institutionsRepository
;
ApplicationConfig
applicationConfig
;
...
...
@@ -58,7 +58,7 @@ public class WebInstRequestFilter extends GenericFilterBean {
if
(
host
.
indexOf
(
":"
)>
-
1
)
{
host
=
host
.
split
(
":"
)[
0
];
}
Institutions
institution
=
institution
Service
.
findByDomain
(
host
);
Institutions
institution
=
institution
sRepository
.
findByDomain
(
host
);
_logger
.
trace
(
"{}"
,
institution
);
request
.
getSession
().
setAttribute
(
WebConstants
.
CURRENT_INST
,
institution
);
WebContext
.
setCookie
((
HttpServletResponse
)
servletResponse
,
host
,
WebConstants
.
INST_COOKIE_NAME
,
institution
.
getId
());
...
...
@@ -66,9 +66,9 @@ public class WebInstRequestFilter extends GenericFilterBean {
chain
.
doFilter
(
servletRequest
,
servletResponse
);
}
public
WebInstRequestFilter
(
Institution
Service
institutionService
,
ApplicationConfig
applicationConfig
)
{
public
WebInstRequestFilter
(
Institution
sRepository
institutionsRepository
,
ApplicationConfig
applicationConfig
)
{
super
();
this
.
institution
Service
=
institutionService
;
this
.
institution
sRepository
=
institutionsRepository
;
this
.
applicationConfig
=
applicationConfig
;
}
...
...
maxkey-core/src/main/java/org/maxkey/web/tag/LocaleTagDirective.java
浏览文件 @
e0a274fa
...
...
@@ -26,7 +26,7 @@ import java.io.IOException;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.maxkey.persistence.
db.LocalizationService
;
import
org.maxkey.persistence.
repository.LocalizationRepository
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -51,7 +51,7 @@ public class LocaleTagDirective implements TemplateDirectiveModel {
private
HttpServletRequest
request
;
@Autowired
Localization
Service
localizationService
;
Localization
Repository
localizationService
;
@SuppressWarnings
(
"rawtypes"
)
@Override
...
...
maxkey-gataway/src/main/java/org/gateway/GatewayApplication.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.gateway
;
import
org.springframework.boot.SpringApplication
;
...
...
maxkey-gataway/src/main/java/org/gateway/controller/FallbackController.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.gateway.controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
maxkey-gataway/src/main/java/org/gateway/filter/AuthAndLogFilter.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.gateway.filter
;
import
org.slf4j.Logger
;
...
...
maxkey-gataway/src/main/java/org/gateway/route/NacosDynamicRouteService.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
/*
package org.gateway.route;
...
...
maxkey-identitys/maxkey-identity-scim/src/main/java/org/maxkey/identity/scim/resources/ScimParameters.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey.identity.scim.resources
;
import
org.maxkey.identity.scim.controller.ScimServiceProviderConfigController
;
...
...
maxkey-persistence/src/main/java/org/maxkey/persistence/service/UserInfoService.java
浏览文件 @
e0a274fa
...
...
@@ -24,11 +24,11 @@ import org.maxkey.crypto.password.PasswordReciprocal;
import
org.maxkey.entity.Accounts
;
import
org.maxkey.entity.ChangePassword
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.db.PasswordPolicyValidator
;
import
org.maxkey.persistence.kafka.KafkaIdentityAction
;
import
org.maxkey.persistence.kafka.KafkaIdentityTopic
;
import
org.maxkey.persistence.kafka.KafkaPersistService
;
import
org.maxkey.persistence.mapper.UserInfoMapper
;
import
org.maxkey.persistence.repository.PasswordPolicyValidator
;
import
org.maxkey.util.DateUtils
;
import
org.maxkey.util.StringUtils
;
import
org.maxkey.web.WebContext
;
...
...
maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/OAuth2UserDetailsService.java
浏览文件 @
e0a274fa
...
...
@@ -18,7 +18,7 @@ import org.maxkey.authn.AbstractAuthenticationProvider;
import
org.maxkey.authn.SigninPrincipal
;
import
org.maxkey.authn.online.OnlineTicket
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.
db.LoginService
;
import
org.maxkey.persistence.
repository.LoginRepository
;
import
org.maxkey.web.WebConstants
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -35,18 +35,12 @@ public class OAuth2UserDetailsService implements UserDetailsService {
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
OAuth2UserDetailsService
.
class
);
Login
Service
loginService
;
Login
Repository
loginRepository
;
public
void
setLoginService
(
LoginService
loginService
)
{
this
.
loginService
=
loginService
;
}
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
UserInfo
userInfo
;
try
{
userInfo
=
login
Service
.
find
(
username
,
""
);
userInfo
=
login
Repository
.
find
(
username
,
""
);
}
catch
(
NoSuchClientException
e
)
{
throw
new
UsernameNotFoundException
(
e
.
getMessage
(),
e
);
}
...
...
@@ -58,7 +52,7 @@ public class OAuth2UserDetailsService implements UserDetailsService {
//set OnlineTicket
signinPrincipal
.
setOnlineTicket
(
onlineTicket
);
ArrayList
<
GrantedAuthority
>
grantedAuthoritys
=
login
Service
.
grantAuthority
(
userInfo
);
ArrayList
<
GrantedAuthority
>
grantedAuthoritys
=
login
Repository
.
grantAuthority
(
userInfo
);
signinPrincipal
.
setAuthenticated
(
true
);
for
(
GrantedAuthority
administratorsAuthority
:
AbstractAuthenticationProvider
.
grantedAdministratorsAuthoritys
)
{
...
...
@@ -74,4 +68,9 @@ public class OAuth2UserDetailsService implements UserDetailsService {
return
signinPrincipal
;
}
public
void
setLoginRepository
(
LoginRepository
loginRepository
)
{
this
.
loginRepository
=
loginRepository
;
}
}
maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/autoconfigure/Oauth20AutoConfiguration.java
浏览文件 @
e0a274fa
...
...
@@ -43,8 +43,8 @@ import org.maxkey.configuration.oidc.OIDCProviderMetadataDetails;
import
org.maxkey.crypto.jose.keystore.JWKSetKeyStore
;
import
org.maxkey.crypto.jwt.encryption.service.impl.DefaultJwtEncryptionAndDecryptionService
;
import
org.maxkey.crypto.jwt.signer.service.impl.DefaultJwtSigningAndValidationService
;
import
org.maxkey.persistence.db.LoginService
;
import
org.maxkey.persistence.redis.RedisConnectionFactory
;
import
org.maxkey.persistence.repository.LoginRepository
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.InitializingBean
;
...
...
@@ -303,11 +303,11 @@ public class Oauth20AutoConfiguration implements InitializingBean {
@Bean
(
name
=
"oauth20UserAuthenticationManager"
)
public
ProviderManager
oauth20UserAuthenticationManager
(
PasswordEncoder
passwordEncoder
,
Login
Service
loginService
Login
Repository
loginRepository
)
{
OAuth2UserDetailsService
userDetailsService
=
new
OAuth2UserDetailsService
();
userDetailsService
.
setLogin
Service
(
loginService
);
userDetailsService
.
setLogin
Repository
(
loginRepository
);
DaoAuthenticationProvider
daoAuthenticationProvider
=
new
DaoAuthenticationProvider
();
daoAuthenticationProvider
.
setPasswordEncoder
(
passwordEncoder
);
...
...
maxkey-webs/maxkey-boot-monitor/src/main/java/org/maxkey/boot/monitor/MaxKeyBootMonitor.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey.boot.monitor
;
import
org.slf4j.Logger
;
...
...
maxkey-webs/maxkey-boot-monitor/src/main/java/org/maxkey/boot/monitor/MonitorSecurityConfigurer.java
浏览文件 @
e0a274fa
/*
* Copyright [2022] [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.
*/
package
org.maxkey.boot.monitor
;
import
org.springframework.context.annotation.Configuration
;
...
...
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyConfig.java
浏览文件 @
e0a274fa
...
...
@@ -45,12 +45,12 @@ import org.maxkey.password.onetimepwd.impl.sms.SmsOtpAuthnAliyun;
import
org.maxkey.password.onetimepwd.impl.sms.SmsOtpAuthnTencentCloud
;
import
org.maxkey.password.onetimepwd.impl.sms.SmsOtpAuthnYunxin
;
import
org.maxkey.password.onetimepwd.token.RedisOtpTokenStore
;
import
org.maxkey.persistence.db.LoginHistoryService
;
import
org.maxkey.persistence.db.LoginService
;
import
org.maxkey.persistence.db.PasswordPolicyValidator
;
import
org.maxkey.persistence.ldap.ActiveDirectoryUtils
;
import
org.maxkey.persistence.ldap.LdapUtils
;
import
org.maxkey.persistence.redis.RedisConnectionFactory
;
import
org.maxkey.persistence.repository.LoginHistoryRepository
;
import
org.maxkey.persistence.repository.LoginRepository
;
import
org.maxkey.persistence.repository.PasswordPolicyValidator
;
import
org.maxkey.persistence.service.UserInfoService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -152,8 +152,8 @@ public class MaxKeyConfig implements InitializingBean {
public
JdbcAuthenticationRealm
authenticationRealm
(
PasswordEncoder
passwordEncoder
,
PasswordPolicyValidator
passwordPolicyValidator
,
Login
Service
loginService
,
LoginHistory
Service
loginHistoryService
,
Login
Repository
loginService
,
LoginHistory
Repository
loginHistoryService
,
AbstractRemeberMeService
remeberMeService
,
UserInfoService
userInfoService
,
JdbcTemplate
jdbcTemplate
,
...
...
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/ForgotPasswordContorller.java
浏览文件 @
e0a274fa
...
...
@@ -22,7 +22,7 @@ import java.util.regex.Pattern;
import
org.maxkey.configuration.EmailConfig
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.password.onetimepwd.AbstractOtpAuthn
;
import
org.maxkey.persistence.
db
.PasswordPolicyValidator
;
import
org.maxkey.persistence.
repository
.PasswordPolicyValidator
;
import
org.maxkey.persistence.service.UserInfoService
;
import
org.maxkey.web.WebConstants
;
import
org.maxkey.web.WebContext
;
...
...
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SafeController.java
浏览文件 @
e0a274fa
...
...
@@ -25,7 +25,7 @@ import org.maxkey.constants.ConstantsPasswordSetType;
import
org.maxkey.constants.ConstantsTimeInterval
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.
db
.PasswordPolicyValidator
;
import
org.maxkey.persistence.
repository
.PasswordPolicyValidator
;
import
org.maxkey.persistence.service.UserInfoService
;
import
org.maxkey.util.StringUtils
;
import
org.maxkey.web.WebConstants
;
...
...
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/LoginSessionController.java
浏览文件 @
e0a274fa
...
...
@@ -24,8 +24,8 @@ import org.maxkey.authn.online.OnlineTicketServices;
import
org.maxkey.constants.ConstantsOperateMessage
;
import
org.maxkey.entity.HistoryLogin
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.
db.LoginHistoryService
;
import
org.maxkey.persistence.
db.LoginService
;
import
org.maxkey.persistence.
repository.LoginHistoryRepository
;
import
org.maxkey.persistence.
repository.LoginRepository
;
import
org.maxkey.persistence.service.HistoryLoginService
;
import
org.maxkey.util.DateUtils
;
import
org.maxkey.util.StringUtils
;
...
...
@@ -60,10 +60,10 @@ public class LoginSessionController {
@Autowired
HistoryLoginService
historyLoginService
;
@Autowired
Login
Service
loginService
;
Login
Repository
loginRepository
;
@Autowired
LoginHistory
Service
loginHistoryService
;
LoginHistory
Repository
loginHistoryRepository
;
@Autowired
OnlineTicketServices
onlineTicketServices
;
...
...
@@ -108,8 +108,8 @@ public class LoginSessionController {
}
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
String
lastLogoffTime
=
DateUtils
.
formatDateTime
(
new
Date
());
login
Service
.
updateLastLogoff
(
userInfo
);
loginHistory
Service
.
logoff
(
lastLogoffTime
,
sessionId
);
login
Repository
.
updateLastLogoff
(
userInfo
);
loginHistory
Repository
.
logoff
(
lastLogoffTime
,
sessionId
);
onlineTicketServices
.
remove
(
"OT-"
+
sessionId
);
}
isTerminated
=
true
;
...
...
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/MaxKeyMgtConfig.java
浏览文件 @
e0a274fa
...
...
@@ -19,9 +19,9 @@ package org.maxkey;
import
org.maxkey.password.onetimepwd.AbstractOtpAuthn
;
import
org.maxkey.password.onetimepwd.impl.TimeBasedOtpAuthn
;
import
org.maxkey.persistence.
db.LoginHistoryService
;
import
org.maxkey.persistence.
db.LoginService
;
import
org.maxkey.persistence.
db
.PasswordPolicyValidator
;
import
org.maxkey.persistence.
repository.LoginHistoryRepository
;
import
org.maxkey.persistence.
repository.LoginRepository
;
import
org.maxkey.persistence.
repository
.PasswordPolicyValidator
;
import
org.maxkey.persistence.service.UserInfoService
;
import
org.maxkey.authn.realm.jdbc.JdbcAuthenticationRealm
;
import
org.maxkey.authn.support.rememberme.AbstractRemeberMeService
;
...
...
@@ -42,8 +42,8 @@ public class MaxKeyMgtConfig implements InitializingBean {
public
JdbcAuthenticationRealm
authenticationRealm
(
PasswordEncoder
passwordEncoder
,
PasswordPolicyValidator
passwordPolicyValidator
,
Login
Service
loginService
,
LoginHistory
Service
loginHistoryService
,
Login
Repository
loginRepository
,
LoginHistory
Repository
loginHistoryRepository
,
AbstractRemeberMeService
remeberMeService
,
UserInfoService
userInfoService
,
JdbcTemplate
jdbcTemplate
)
{
...
...
@@ -51,8 +51,8 @@ public class MaxKeyMgtConfig implements InitializingBean {
JdbcAuthenticationRealm
authenticationRealm
=
new
JdbcAuthenticationRealm
(
passwordEncoder
,
passwordPolicyValidator
,
login
Service
,
loginHistory
Service
,
login
Repository
,
loginHistory
Repository
,
remeberMeService
,
userInfoService
,
jdbcTemplate
);
...
...
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/LocalizationController.java
浏览文件 @
e0a274fa
...
...
@@ -20,7 +20,7 @@ package org.maxkey.web.contorller;
import
org.apache.commons.lang3.StringUtils
;
import
org.maxkey.constants.ConstantsOperateMessage
;
import
org.maxkey.entity.Localization
;
import
org.maxkey.persistence.
db.LocalizationService
;
import
org.maxkey.persistence.
repository.LocalizationRepository
;
import
org.maxkey.web.WebContext
;
import
org.maxkey.web.message.Message
;
import
org.maxkey.web.message.MessageType
;
...
...
@@ -43,7 +43,7 @@ public class LocalizationController {
final
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
LocalizationController
.
class
);
@Autowired
private
Localization
Service
localizationService
;
private
Localization
Repository
localizationRepository
;
/**
* 读取
...
...
@@ -51,7 +51,7 @@ public class LocalizationController {
*/
@RequestMapping
(
value
={
"/forward/{property}"
})
public
ModelAndView
forward
(
@PathVariable
(
"property"
)
String
property
){
Localization
localization
=
localization
Service
.
get
(
property
,
WebContext
.
getUserInfo
().
getInstId
());
Localization
localization
=
localization
Repository
.
get
(
property
,
WebContext
.
getUserInfo
().
getInstId
());
if
(
localization
==
null
)
localization
=
new
Localization
();
localization
.
setProperty
(
property
);
localization
.
setInstId
(
WebContext
.
getUserInfo
().
getInstId
());
...
...
@@ -70,13 +70,13 @@ public class LocalizationController {
localization
.
setInstId
(
WebContext
.
getUserInfo
().
getInstId
());
if
(
StringUtils
.
isBlank
(
localization
.
getId
())){
localization
.
setId
(
localization
.
generateId
());
if
(
localization
Service
.
insert
(
localization
))
{
if
(
localization
Repository
.
insert
(
localization
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
else
{
if
(
localization
Service
.
update
(
localization
))
{
if
(
localization
Repository
.
update
(
localization
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
...
...
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/historys/contorller/LoginSessionController.java
浏览文件 @
e0a274fa
...
...
@@ -24,8 +24,8 @@ import org.maxkey.authn.online.OnlineTicketServices;
import
org.maxkey.constants.ConstantsOperateMessage
;
import
org.maxkey.entity.HistoryLogin
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.
db.LoginHistoryService
;
import
org.maxkey.persistence.
db.LoginService
;
import
org.maxkey.persistence.
repository.LoginHistoryRepository
;
import
org.maxkey.persistence.
repository.LoginRepository
;
import
org.maxkey.persistence.service.HistoryLoginService
;
import
org.maxkey.util.DateUtils
;
import
org.maxkey.util.StringUtils
;
...
...
@@ -60,10 +60,10 @@ public class LoginSessionController {
@Autowired
HistoryLoginService
historyLoginService
;
@Autowired
Login
Service
loginService
;
Login
Repository
loginRepository
;
@Autowired
LoginHistory
Service
loginHistoryService
;
LoginHistory
Repository
loginHistoryRepository
;
@Autowired
OnlineTicketServices
onlineTicketServices
;
...
...
@@ -106,8 +106,8 @@ public class LoginSessionController {
}
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
String
lastLogoffTime
=
DateUtils
.
formatDateTime
(
new
Date
());
login
Service
.
updateLastLogoff
(
userInfo
);
loginHistory
Service
.
logoff
(
lastLogoffTime
,
sessionId
);
login
Repository
.
updateLastLogoff
(
userInfo
);
loginHistory
Repository
.
logoff
(
lastLogoffTime
,
sessionId
);
onlineTicketServices
.
remove
(
"OT-"
+
sessionId
);
}
isTerminated
=
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录