Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
f3b799e7
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,发现更多精彩内容 >>
提交
f3b799e7
编写于
4月 12, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix format
上级
2fb491b4
变更
88
显示空白变更内容
内联
并排
Showing
88 changed file
with
1202 addition
and
1286 deletion
+1202
-1286
maxkey-authentications/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java
.../java/org/maxkey/authn/support/basic/BasicEntryPoint.java
+2
-2
maxkey-authentications/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java
...maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java
+2
-2
maxkey-authentications/src/main/java/org/maxkey/authn/support/kerberos/RemoteKerberosService.java
.../maxkey/authn/support/kerberos/RemoteKerberosService.java
+2
-2
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/SocialSignOnEndpoint.java
...xkey/authn/support/socialsignon/SocialSignOnEndpoint.java
+2
-2
maxkey-authentications/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationServiceImpl.java
...y/authn/support/wsfederation/WsFederationServiceImpl.java
+2
-2
maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java
...java/org/maxkey/authn/AbstractAuthenticationProvider.java
+3
-3
maxkey-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
...a/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
+10
-10
maxkey-core/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java
...in/java/org/maxkey/authn/support/jwt/JwtLoginService.java
+167
-188
maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java
...ey/authn/support/rememberme/AbstractRemeberMeService.java
+2
-2
maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java
...n/java/org/maxkey/authn/support/rememberme/RemeberMe.java
+10
-6
maxkey-core/src/main/java/org/maxkey/constants/BOOLEAN.java
maxkey-core/src/main/java/org/maxkey/constants/BOOLEAN.java
+0
-44
maxkey-core/src/main/java/org/maxkey/constants/Boolean.java
maxkey-core/src/main/java/org/maxkey/constants/Boolean.java
+41
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsEntryType.java
...rc/main/java/org/maxkey/constants/ConstantsEntryType.java
+12
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsLoginType.java
...rc/main/java/org/maxkey/constants/ConstantsLoginType.java
+20
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsOperateAction.java
...ain/java/org/maxkey/constants/ConstantsOperateAction.java
+19
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsOperateMessage.java
...in/java/org/maxkey/constants/ConstantsOperateMessage.java
+14
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsPasswordSetType.java
...n/java/org/maxkey/constants/ConstantsPasswordSetType.java
+18
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsPlatformRole.java
...main/java/org/maxkey/constants/ConstantsPlatformRole.java
+10
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsProtocols.java
...rc/main/java/org/maxkey/constants/ConstantsProtocols.java
+29
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsServiceMessage.java
...in/java/org/maxkey/constants/ConstantsServiceMessage.java
+120
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsStatus.java
...e/src/main/java/org/maxkey/constants/ConstantsStatus.java
+30
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsTimeInterval.java
...main/java/org/maxkey/constants/ConstantsTimeInterval.java
+23
-0
maxkey-core/src/main/java/org/maxkey/constants/ENTRY_TYPE.java
...y-core/src/main/java/org/maxkey/constants/ENTRY_TYPE.java
+0
-12
maxkey-core/src/main/java/org/maxkey/constants/LOGINTYPE.java
...ey-core/src/main/java/org/maxkey/constants/LOGINTYPE.java
+0
-21
maxkey-core/src/main/java/org/maxkey/constants/OPERATEACTION.java
...ore/src/main/java/org/maxkey/constants/OPERATEACTION.java
+0
-19
maxkey-core/src/main/java/org/maxkey/constants/OPERATEMESSAGE.java
...re/src/main/java/org/maxkey/constants/OPERATEMESSAGE.java
+0
-16
maxkey-core/src/main/java/org/maxkey/constants/PASSWORDSETTYPE.java
...e/src/main/java/org/maxkey/constants/PASSWORDSETTYPE.java
+0
-20
maxkey-core/src/main/java/org/maxkey/constants/PLATFORMROLE.java
...core/src/main/java/org/maxkey/constants/PLATFORMROLE.java
+0
-10
maxkey-core/src/main/java/org/maxkey/constants/PROTOCOLS.java
...ey-core/src/main/java/org/maxkey/constants/PROTOCOLS.java
+0
-38
maxkey-core/src/main/java/org/maxkey/constants/SERVICEMESSAGE.java
...re/src/main/java/org/maxkey/constants/SERVICEMESSAGE.java
+0
-121
maxkey-core/src/main/java/org/maxkey/constants/STATUS.java
maxkey-core/src/main/java/org/maxkey/constants/STATUS.java
+0
-30
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/AbstractOptAuthn.java
...java/org/maxkey/crypto/password/opt/AbstractOptAuthn.java
+4
-99
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/CapOtpAuthn.java
...java/org/maxkey/crypto/password/opt/impl/CapOtpAuthn.java
+0
-5
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/CounterBasedOtpAuthn.java
...maxkey/crypto/password/opt/impl/CounterBasedOtpAuthn.java
+0
-4
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/HotpOtpAuthn.java
...ava/org/maxkey/crypto/password/opt/impl/HotpOtpAuthn.java
+0
-5
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/MailOtpAuthn.java
...ava/org/maxkey/crypto/password/opt/impl/MailOtpAuthn.java
+2
-7
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/MobileOtpAuthn.java
...a/org/maxkey/crypto/password/opt/impl/MobileOtpAuthn.java
+0
-5
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/RsaOtpAuthn.java
...java/org/maxkey/crypto/password/opt/impl/RsaOtpAuthn.java
+0
-5
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/SmsOtpAuthn.java
...java/org/maxkey/crypto/password/opt/impl/SmsOtpAuthn.java
+1
-7
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/TimeBasedOtpAuthn.java
...rg/maxkey/crypto/password/opt/impl/TimeBasedOtpAuthn.java
+1
-3
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/sms/netease/SmsOtpAuthnYunxin.java
...ypto/password/opt/impl/sms/netease/SmsOtpAuthnYunxin.java
+2
-4
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/token/AbstractOptTokenStore.java
...xkey/crypto/password/opt/token/AbstractOptTokenStore.java
+5
-0
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/token/InMemoryOptTokenStore.java
...xkey/crypto/password/opt/token/InMemoryOptTokenStore.java
+19
-0
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/token/JdbcOptTokenStore.java
...g/maxkey/crypto/password/opt/token/JdbcOptTokenStore.java
+110
-0
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/token/RedisOptTokenStore.java
.../maxkey/crypto/password/opt/token/RedisOptTokenStore.java
+5
-0
maxkey-core/src/main/java/org/maxkey/domain/PasswordPolicy.java
...-core/src/main/java/org/maxkey/domain/PasswordPolicy.java
+298
-371
maxkey-core/src/main/java/org/maxkey/domain/apps/Apps.java
maxkey-core/src/main/java/org/maxkey/domain/apps/Apps.java
+2
-2
maxkey-dao/src/main/java/org/maxkey/dao/service/MyProfileService.java
...rc/main/java/org/maxkey/dao/service/MyProfileService.java
+0
-2
maxkey-dao/src/main/java/org/maxkey/dao/service/UserInfoService.java
...src/main/java/org/maxkey/dao/service/UserInfoService.java
+3
-3
maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/AuthorizeEndpoint.java
...ain/java/org/maxkey/authz/endpoint/AuthorizeEndpoint.java
+10
-10
maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/adapter/AbstractAuthorizeAdapter.java
...xkey/authz/endpoint/adapter/AbstractAuthorizeAdapter.java
+2
-2
maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/Cas20AuthorizeEndpoint.java
...org/maxkey/authz/cas/endpoint/Cas20AuthorizeEndpoint.java
+2
-2
maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/Cas30AuthorizeEndpoint.java
...org/maxkey/authz/cas/endpoint/Cas30AuthorizeEndpoint.java
+3
-3
maxkey-protocols/maxkey-protocol-desktop/src/main/java/org/maxkey/authz/desktop/endpoint/DesktopAuthorizeEndpoint.java
...xkey/authz/desktop/endpoint/DesktopAuthorizeEndpoint.java
+2
-2
maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/ExtendApiAuthorizeEndpoint.java
...xkey/authz/exapi/endpoint/ExtendApiAuthorizeEndpoint.java
+2
-2
maxkey-protocols/maxkey-protocol-formbased/src/main/java/org/maxkey/authz/formbased/endpoint/FormBasedAuthorizeEndpoint.java
.../authz/formbased/endpoint/FormBasedAuthorizeEndpoint.java
+2
-2
maxkey-protocols/maxkey-protocol-formbased/src/main/java/org/maxkey/authz/formbased/endpoint/adapter/FormBasedDefaultAdapter.java
...z/formbased/endpoint/adapter/FormBasedDefaultAdapter.java
+2
-2
maxkey-protocols/maxkey-protocol-formbased/src/main/java/org/maxkey/authz/formbased/endpoint/adapter/FormBasedNetease163EmailAdapter.java
...sed/endpoint/adapter/FormBasedNetease163EmailAdapter.java
+2
-2
maxkey-protocols/maxkey-protocol-formbased/src/main/java/org/maxkey/authz/formbased/endpoint/adapter/FormBasedRedirectAdapter.java
.../formbased/endpoint/adapter/FormBasedRedirectAdapter.java
+2
-2
maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/userinfo/endpoint/UserInfoEndpoint.java
...z/oauth2/provider/userinfo/endpoint/UserInfoEndpoint.java
+2
-2
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java
...xkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java
+2
-2
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/AttributeStatementGenerator.java
...uthz/saml20/provider/xml/AttributeStatementGenerator.java
+2
-2
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/AuthnResponseGenerator.java
...key/authz/saml20/provider/xml/AuthnResponseGenerator.java
+2
-2
maxkey-protocols/maxkey-protocol-tokenbased/src/main/java/org/maxkey/authz/token/endpoint/TokenBasedAuthorizeEndpoint.java
...key/authz/token/endpoint/TokenBasedAuthorizeEndpoint.java
+2
-2
maxkey-protocols/maxkey-protocol-tokenbased/src/main/java/org/maxkey/authz/token/endpoint/adapter/TokenBasedDefaultAdapter.java
...uthz/token/endpoint/adapter/TokenBasedDefaultAdapter.java
+8
-8
maxkey-protocols/maxkey-protocol-tokenbased/src/main/java/org/maxkey/authz/token/endpoint/adapter/TokenBasedSimpleAdapter.java
...authz/token/endpoint/adapter/TokenBasedSimpleAdapter.java
+7
-7
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/ApplicationsController.java
...rg/maxkey/web/apps/contorller/ApplicationsController.java
+11
-11
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/BaseAppContorller.java
...ava/org/maxkey/web/apps/contorller/BaseAppContorller.java
+3
-3
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/BasicDetailsController.java
...rg/maxkey/web/apps/contorller/BasicDetailsController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/CasDetailsController.java
.../org/maxkey/web/apps/contorller/CasDetailsController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/DesktopDetailsController.java
.../maxkey/web/apps/contorller/DesktopDetailsController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/ExtendApiDetailsController.java
...axkey/web/apps/contorller/ExtendApiDetailsController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/FormBasedDetailsController.java
...axkey/web/apps/contorller/FormBasedDetailsController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/OAuth20DetailsController.java
.../maxkey/web/apps/contorller/OAuth20DetailsController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/SAML20DetailsController.java
...g/maxkey/web/apps/contorller/SAML20DetailsController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/TokenBasedDetailsController.java
...xkey/web/apps/contorller/TokenBasedDetailsController.java
+9
-11
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/AccountsController.java
...in/java/org/maxkey/web/contorller/AccountsController.java
+4
-4
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/GroupMemberController.java
...java/org/maxkey/web/contorller/GroupMemberController.java
+5
-5
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/GroupPrivilegesController.java
.../org/maxkey/web/contorller/GroupPrivilegesController.java
+5
-5
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/GroupsController.java
...main/java/org/maxkey/web/contorller/GroupsController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/IpAddrFilterController.java
...ava/org/maxkey/web/contorller/IpAddrFilterController.java
+9
-9
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/PasswordPolicyController.java
...a/org/maxkey/web/contorller/PasswordPolicyController.java
+3
-3
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/UserInfoController.java
...in/java/org/maxkey/web/contorller/UserInfoController.java
+11
-11
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/AppListController.java
...ain/java/org/maxkey/web/contorller/AppListController.java
+8
-8
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/ProfileController.java
...ain/java/org/maxkey/web/contorller/ProfileController.java
+3
-3
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/RegistrationController.java
...ava/org/maxkey/web/contorller/RegistrationController.java
+2
-2
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SafeController.java
...c/main/java/org/maxkey/web/contorller/SafeController.java
+8
-8
maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/IndexEndpoint.java
.../src/main/java/org/maxkey/web/endpoint/IndexEndpoint.java
+5
-5
未找到文件。
maxkey-authentications/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java
浏览文件 @
f3b799e7
...
...
@@ -3,7 +3,7 @@ package org.maxkey.authn.support.basic;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.util.AuthorizationHeaderUtils
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
...
...
@@ -99,7 +99,7 @@ public class BasicEntryPoint extends HandlerInterceptorAdapter {
}
if
(!
isAuthenticated
){
if
(
WebContext
.
setAuthentication
(
username
,
LOGINTYPE
.
BASIC
,
""
,
""
,
"success"
)){
if
(
WebContext
.
setAuthentication
(
username
,
ConstantsLoginType
.
BASIC
,
""
,
""
,
"success"
)){
_logger
.
info
(
"Authentication "
+
username
+
" successful ."
);
}
}
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java
浏览文件 @
f3b799e7
...
...
@@ -3,7 +3,7 @@ package org.maxkey.authn.support.httpheader;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -86,7 +86,7 @@ public class HttpHeaderEntryPoint extends HandlerInterceptorAdapter {
}
if
(!
isAuthenticated
){
if
(
WebContext
.
setAuthentication
(
httpHeaderUsername
,
LOGINTYPE
.
HTTPHEADER
,
""
,
""
,
"success"
)){
if
(
WebContext
.
setAuthentication
(
httpHeaderUsername
,
ConstantsLoginType
.
HTTPHEADER
,
""
,
""
,
"success"
)){
_logger
.
info
(
"Authentication "
+
httpHeaderUsername
+
" successful ."
);
}
}
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/kerberos/RemoteKerberosService.java
浏览文件 @
f3b799e7
...
...
@@ -6,7 +6,7 @@ import java.util.List;
import
java.util.Map
;
import
org.joda.time.DateTime
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.util.DateUtils
;
import
org.maxkey.util.JsonUtils
;
...
...
@@ -37,7 +37,7 @@ public class RemoteKerberosService implements KerberosService{
DateTime
notOnOrAfter
=
DateUtils
.
toUtcDate
(
kerberosToken
.
getNotOnOrAfter
());
_logger
.
debug
(
"Kerberos Token is After Now "
+
notOnOrAfter
.
isAfterNow
());
if
(
notOnOrAfter
.
isAfterNow
()){
return
WebContext
.
setAuthentication
(
kerberosToken
.
getPrincipal
(),
LOGINTYPE
.
KERBEROS
,
kerberosUserDomain
,
""
,
"success"
);
return
WebContext
.
setAuthentication
(
kerberosToken
.
getPrincipal
(),
ConstantsLoginType
.
KERBEROS
,
kerberosUserDomain
,
""
,
"success"
);
}
else
{
return
false
;
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/SocialSignOnEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletRequest;
import
org.maxkey.authn.realm.AbstractAuthenticationRealm
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnUserToken
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -138,7 +138,7 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
_logger
.
debug
(
"Social Sign On from "
+
socialSignOnUserToken
.
getProvider
()+
" mapping to user "
+
socialSignOnUserToken
.
getUsername
());
if
(
WebContext
.
setAuthentication
(
socialSignOnUserToken
.
getUsername
(),
LOGINTYPE
.
SOCIALSIGNON
,
this
.
socialSignOnProvider
.
getProviderName
(),
"xe00000004"
,
"success"
)){
if
(
WebContext
.
setAuthentication
(
socialSignOnUserToken
.
getUsername
(),
ConstantsLoginType
.
SOCIALSIGNON
,
this
.
socialSignOnProvider
.
getProviderName
(),
"xe00000004"
,
"success"
)){
//socialSignOnUserToken.setAccessToken(JsonUtils.object2Json(this.accessToken));
socialSignOnUserToken
.
setSocialUserInfo
(
accountJsonString
);
//socialSignOnUserToken.setExAttribute(JsonUtils.object2Json(accessToken.getResponseObject()));
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/wsfederation/WsFederationServiceImpl.java
浏览文件 @
f3b799e7
...
...
@@ -2,7 +2,7 @@ package org.maxkey.authn.support.wsfederation;
import
javax.servlet.http.HttpServletRequest
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.util.StringUtils
;
import
org.maxkey.web.WebContext
;
import
org.opensaml.saml1.core.impl.AssertionImpl
;
...
...
@@ -42,7 +42,7 @@ public class WsFederationServiceImpl implements WsFederationService{
return
WebContext
.
setAuthentication
(
wsFederationCredential
.
getAttributes
().
get
(
""
).
toString
(),
LOGINTYPE
.
WSFEDERATION
,
ConstantsLoginType
.
WSFEDERATION
,
""
,
""
,
"success"
);
}
else
{
...
...
maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java
浏览文件 @
f3b799e7
...
...
@@ -3,7 +3,7 @@ package org.maxkey.authn;
import
org.maxkey.authn.realm.AbstractAuthenticationRealm
;
import
org.maxkey.authn.support.rememberme.AbstractRemeberMeService
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.crypto.password.opt.AbstractOptAuthn
;
import
org.maxkey.domain.UserInfo
;
...
...
@@ -93,7 +93,7 @@ public abstract class AbstractAuthenticationProvider {
_logger
.
debug
(
"Login Success Session {}."
,
WebContext
.
getSession
().
getId
());
authenticationRealm
.
insertLoginHistory
(
userInfo
,
LOGINTYPE
.
LOCAL
,
""
,
"xe00000004"
,
"success"
);
userInfo
,
ConstantsLoginType
.
LOCAL
,
""
,
"xe00000004"
,
"success"
);
// 认证设置
WebContext
.
setAuthentication
(
authentication
);
...
...
@@ -268,7 +268,7 @@ public abstract class AbstractAuthenticationProvider {
loginUser
.
setId
(
loginUser
.
generateId
());
loginUser
.
setDisplayName
(
"not exist"
);
loginUser
.
setLoginCount
(
0
);
authenticationRealm
.
insertLoginHistory
(
loginUser
,
LOGINTYPE
.
LOCAL
,
""
,
authenticationRealm
.
insertLoginHistory
(
loginUser
,
ConstantsLoginType
.
LOCAL
,
""
,
WebContext
.
getI18nValue
(
"login.error.username"
),
"user not exist"
);
throw
new
BadCredentialsException
(
WebContext
.
getI18nValue
(
"login.error.username"
));
}
...
...
maxkey-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
浏览文件 @
f3b799e7
...
...
@@ -11,9 +11,9 @@ import org.joda.time.DateTime;
import
org.joda.time.Duration
;
import
org.joda.time.format.DateTimeFormat
;
import
org.maxkey.authn.support.rememberme.AbstractRemeberMeService
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
PASSWORDSETTYPE
;
import
org.maxkey.constants.
STATUS
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.constants.
ConstantsPasswordSetType
;
import
org.maxkey.constants.
ConstantsStatus
;
import
org.maxkey.domain.Groups
;
import
org.maxkey.domain.PasswordPolicy
;
import
org.maxkey.domain.UserInfo
;
...
...
@@ -108,13 +108,13 @@ public abstract class AbstractAuthenticationRealm {
WebContext
.
getI18nValue
(
"login.error.attempts"
)
+
" "
+
userInfo
.
getBadPasswordCount
());
}
if
(
userInfo
.
getPasswordSetType
()
!=
PASSWORDSETTYPE
.
PASSWORD_NORMAL
)
{
if
(
userInfo
.
getPasswordSetType
()
!=
ConstantsPasswordSetType
.
PASSWORD_NORMAL
)
{
WebContext
.
getSession
().
setAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
,
userInfo
.
getPasswordSetType
());
return
true
;
}
else
{
WebContext
.
getSession
().
setAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
,
PASSWORDSETTYPE
.
PASSWORD_NORMAL
);
ConstantsPasswordSetType
.
PASSWORD_NORMAL
);
}
/*
...
...
@@ -134,7 +134,7 @@ public abstract class AbstractAuthenticationRealm {
_logger
.
debug
(
"validate result "
+
(
intDuration
<=
getPasswordPolicy
().
getExpiration
()));
if
(
intDuration
>
getPasswordPolicy
().
getExpiration
())
{
WebContext
.
getSession
().
setAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
,
PASSWORDSETTYPE
.
PASSWORD_EXPIRED
);
ConstantsPasswordSetType
.
PASSWORD_EXPIRED
);
}
}
...
...
@@ -171,7 +171,7 @@ public abstract class AbstractAuthenticationRealm {
try
{
if
(
userInfo
!=
null
&&
StringUtils
.
isNotEmpty
(
userInfo
.
getId
()))
{
jdbcTemplate
.
update
(
LOCK_USER_UPDATE_STATEMENT
,
new
Object
[]
{
STATUS
.
LOCK
,
new
Date
(),
userInfo
.
getId
()
},
new
Object
[]
{
ConstantsStatus
.
LOCK
,
new
Date
(),
userInfo
.
getId
()
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
TIMESTAMP
,
Types
.
VARCHAR
});
}
}
catch
(
Exception
e
)
{
...
...
@@ -188,7 +188,7 @@ public abstract class AbstractAuthenticationRealm {
try
{
if
(
userInfo
!=
null
&&
StringUtils
.
isNotEmpty
(
userInfo
.
getId
()))
{
jdbcTemplate
.
update
(
UNLOCK_USER_UPDATE_STATEMENT
,
new
Object
[]
{
STATUS
.
ACTIVE
,
new
Date
(),
userInfo
.
getId
()
},
new
Object
[]
{
ConstantsStatus
.
ACTIVE
,
new
Date
(),
userInfo
.
getId
()
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
TIMESTAMP
,
Types
.
VARCHAR
});
}
}
catch
(
Exception
e
)
{
...
...
@@ -205,7 +205,7 @@ public abstract class AbstractAuthenticationRealm {
try
{
if
(
userInfo
!=
null
&&
StringUtils
.
isNotEmpty
(
userInfo
.
getId
()))
{
jdbcTemplate
.
update
(
BADPASSWORDCOUNT_RESET_UPDATE_STATEMENT
,
new
Object
[]
{
0
,
STATUS
.
ACTIVE
,
new
Date
(),
userInfo
.
getId
()
},
new
Object
[]
{
0
,
ConstantsStatus
.
ACTIVE
,
new
Date
(),
userInfo
.
getId
()
},
new
int
[]
{
Types
.
INTEGER
,
Types
.
INTEGER
,
Types
.
TIMESTAMP
,
Types
.
VARCHAR
});
}
}
catch
(
Exception
e
)
{
...
...
@@ -227,7 +227,7 @@ public abstract class AbstractAuthenticationRealm {
jdbcTemplate
.
update
(
BADPASSWORDCOUNT_UPDATE_STATEMENT
,
new
Object
[]
{
badPasswordCount
,
new
Date
(),
userInfo
.
getId
()
},
new
int
[]
{
Types
.
INTEGER
,
Types
.
TIMESTAMP
,
Types
.
VARCHAR
});
insertLoginHistory
(
userInfo
,
LOGINTYPE
.
LOCAL
,
""
,
"xe00000004"
,
"password error"
);
insertLoginHistory
(
userInfo
,
ConstantsLoginType
.
LOCAL
,
""
,
"xe00000004"
,
"password error"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
maxkey-core/src/main/java/org/maxkey/authn/support/jwt/JwtLoginService.java
浏览文件 @
f3b799e7
package
org.maxkey.authn.support.jwt
;
import
com.nimbusds.jose.JOSEException
;
import
com.nimbusds.jose.JWSAlgorithm
;
import
com.nimbusds.jose.JWSHeader
;
import
com.nimbusds.jose.crypto.RSASSAVerifier
;
import
com.nimbusds.jose.jwk.RSAKey
;
import
com.nimbusds.jwt.JWT
;
import
com.nimbusds.jwt.JWTClaimsSet
;
import
com.nimbusds.jwt.PlainJWT
;
import
com.nimbusds.jwt.SignedJWT
;
import
java.util.Date
;
import
java.util.UUID
;
import
javax.servlet.http.HttpServletResponse
;
import
org.joda.time.DateTime
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.config.oidc.OIDCProviderMetadataDetails
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.crypto.jwt.signer.service.impl.DefaultJwtSigningAndValidationService
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.nimbusds.jose.JOSEException
;
import
com.nimbusds.jose.JWSAlgorithm
;
import
com.nimbusds.jose.JWSHeader
;
import
com.nimbusds.jose.crypto.RSASSAVerifier
;
import
com.nimbusds.jose.jwk.RSAKey
;
import
com.nimbusds.jwt.JWT
;
import
com.nimbusds.jwt.JWTClaimsSet
;
import
com.nimbusds.jwt.PlainJWT
;
import
com.nimbusds.jwt.SignedJWT
;
public
class
JwtLoginService
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
JwtLoginService
.
class
);
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
JwtLoginService
.
class
);
protected
ApplicationConfig
applicationConfig
;
...
...
@@ -44,10 +41,8 @@ public class JwtLoginService {
JWTClaimsSet
jwtClaimsSet
=
null
;
try
{
RSASSAVerifier
rsaSSAVerifier
=
new
RSASSAVerifier
(
((
RSAKey
)
jwtSignerValidationService
.
getAllPublicKeys
()
.
get
(
jwtSignerValidationService
.
getDefaultSignerKeyId
())).
toRSAPublicKey
());
RSASSAVerifier
rsaSSAVerifier
=
new
RSASSAVerifier
(((
RSAKey
)
jwtSignerValidationService
.
getAllPublicKeys
()
.
get
(
jwtSignerValidationService
.
getDefaultSignerKeyId
())).
toRSAPublicKey
());
signedJWT
=
SignedJWT
.
parse
(
jwt
);
if
(
signedJWT
.
verify
(
rsaSSAVerifier
))
{
...
...
@@ -62,9 +57,7 @@ public class JwtLoginService {
_logger
.
debug
(
"jwtClaimsSet Issuer "
+
jwtClaimsSet
.
getIssuer
());
_logger
.
debug
(
"Metadata Issuer "
+
jwtProviderMetadata
.
getIssuer
());
if
(
loginResult
&&
jwtClaimsSet
.
getIssuer
().
equals
(
jwtProviderMetadata
.
getIssuer
()))
{
if
(
loginResult
&&
jwtClaimsSet
.
getIssuer
().
equals
(
jwtProviderMetadata
.
getIssuer
()))
{
loginResult
=
true
;
_logger
.
debug
(
"Issuer equals "
);
}
else
{
...
...
@@ -82,10 +75,8 @@ public class JwtLoginService {
DateTime
now
=
new
DateTime
();
if
(
loginResult
&&
now
.
isBefore
(
jwtClaimsSet
.
getExpirationTime
().
getTime
()))
{
if
(
WebContext
.
setAuthentication
(
username
,
LOGINTYPE
.
JWT
,
""
,
""
,
"success"
))
{
if
(
loginResult
&&
now
.
isBefore
(
jwtClaimsSet
.
getExpirationTime
().
getTime
()))
{
if
(
WebContext
.
setAuthentication
(
username
,
ConstantsLoginType
.
JWT
,
""
,
""
,
"success"
))
{
return
true
;
}
}
...
...
@@ -107,20 +98,15 @@ public class JwtLoginService {
DateTime
currentDateTime
=
DateTime
.
now
();
Date
expirationTime
=
currentDateTime
.
plusMinutes
(
5
).
toDate
();
_logger
.
debug
(
"expiration Time : "
+
expirationTime
);
JWTClaimsSet
jwtClaims
=
new
JWTClaimsSet
.
Builder
()
.
subject
(
WebContext
.
getSession
().
getId
())
.
expirationTime
(
expirationTime
)
.
issuer
(
jwtProviderMetadata
.
getIssuer
())
.
issueTime
(
currentDateTime
.
toDate
())
.
jwtID
(
UUID
.
randomUUID
().
toString
())
.
build
();
JWTClaimsSet
jwtClaims
=
new
JWTClaimsSet
.
Builder
().
subject
(
WebContext
.
getSession
().
getId
())
.
expirationTime
(
expirationTime
).
issuer
(
jwtProviderMetadata
.
getIssuer
())
.
issueTime
(
currentDateTime
.
toDate
()).
jwtID
(
UUID
.
randomUUID
().
toString
()).
build
();
JWT
jwtToken
=
new
PlainJWT
(
jwtClaims
);
_logger
.
info
(
"jwt Claims : "
+
jwtClaims
.
toString
());
JWSAlgorithm
signingAlg
=
jwtSignerValidationService
.
getDefaultSigningAlgorithm
();
JWSAlgorithm
signingAlg
=
jwtSignerValidationService
.
getDefaultSigningAlgorithm
();
jwtToken
=
new
SignedJWT
(
new
JWSHeader
(
signingAlg
),
jwtClaims
);
// sign it with the server's key
...
...
@@ -138,10 +124,8 @@ public class JwtLoginService {
JWTClaimsSet
jwtClaimsSet
=
null
;
try
{
RSASSAVerifier
rsaSSAVerifier
=
new
RSASSAVerifier
(
((
RSAKey
)
jwtSignerValidationService
.
getAllPublicKeys
()
.
get
(
jwtSignerValidationService
.
getDefaultSignerKeyId
())).
toRSAPublicKey
());
RSASSAVerifier
rsaSSAVerifier
=
new
RSASSAVerifier
(((
RSAKey
)
jwtSignerValidationService
.
getAllPublicKeys
()
.
get
(
jwtSignerValidationService
.
getDefaultSignerKeyId
())).
toRSAPublicKey
());
signedJWT
=
SignedJWT
.
parse
(
jwt
);
if
(
signedJWT
.
verify
(
rsaSSAVerifier
))
{
...
...
@@ -158,9 +142,7 @@ public class JwtLoginService {
_logger
.
debug
(
"jwtClaimsSet Issuer "
+
jwtClaimsSet
.
getIssuer
());
_logger
.
debug
(
"Metadata Issuer "
+
jwtProviderMetadata
.
getIssuer
());
if
(
loginResult
&&
jwtClaimsSet
.
getIssuer
().
equals
(
jwtProviderMetadata
.
getIssuer
()))
{
if
(
loginResult
&&
jwtClaimsSet
.
getIssuer
().
equals
(
jwtProviderMetadata
.
getIssuer
()))
{
loginResult
=
true
;
_logger
.
debug
(
"Issuer equals "
);
}
else
{
...
...
@@ -170,11 +152,10 @@ public class JwtLoginService {
DateTime
now
=
new
DateTime
();
if
(
loginResult
&&
now
.
isBefore
(
jwtClaimsSet
.
getExpirationTime
().
getTime
()))
{
if
(
loginResult
&&
now
.
isBefore
(
jwtClaimsSet
.
getExpirationTime
().
getTime
()))
{
_logger
.
debug
(
"ExpirationTime Validation "
+
now
.
isBefore
(
jwtClaimsSet
.
getExpirationTime
().
getTime
()));
loginResult
=
true
;
}
else
{
}
else
{
return
false
;
}
}
catch
(
java
.
text
.
ParseException
e
)
{
...
...
@@ -192,13 +173,11 @@ public class JwtLoginService {
this
.
applicationConfig
=
applicationConfig
;
}
public
void
setJwtProviderMetadata
(
OIDCProviderMetadataDetails
jwtProviderMetadata
)
{
public
void
setJwtProviderMetadata
(
OIDCProviderMetadataDetails
jwtProviderMetadata
)
{
this
.
jwtProviderMetadata
=
jwtProviderMetadata
;
}
public
void
setJwtSignerValidationService
(
DefaultJwtSigningAndValidationService
jwtSignerValidationService
)
{
public
void
setJwtSignerValidationService
(
DefaultJwtSigningAndValidationService
jwtSignerValidationService
)
{
this
.
jwtSignerValidationService
=
jwtSignerValidationService
;
}
...
...
maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/AbstractRemeberMeService.java
浏览文件 @
f3b799e7
...
...
@@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
org.joda.time.DateTime
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.crypto.Base64Utils
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.util.JsonUtils
;
...
...
@@ -96,7 +96,7 @@ public abstract class AbstractRemeberMeService {
if
(
now
.
isBefore
(
expiryDate
))
{
if
(
WebContext
.
setAuthentication
(
storeRemeberMe
.
getUsername
(),
LOGINTYPE
.
REMEBER_ME
,
ConstantsLoginType
.
REMEBER_ME
,
""
,
""
,
"success"
)
...
...
maxkey-core/src/main/java/org/maxkey/authn/support/rememberme/RemeberMe.java
浏览文件 @
f3b799e7
...
...
@@ -7,10 +7,7 @@ public class RemeberMe implements Serializable {
private
static
final
long
serialVersionUID
=
8010496585233991785L
;
/**
* The number of seconds in one year (= 60 * 60 * 24 * 365).
*/
public
static
final
Integer
ONE_YEAR
=
60
*
60
*
24
*
365
;
public
static
final
Integer
ONE_DAY
=
60
*
60
*
24
;
// 1 day
...
...
@@ -18,7 +15,14 @@ public class RemeberMe implements Serializable {
public
static
final
Integer
TWO_WEEK
=
ONE_DAY
*
14
;
// 2 week
public
static
final
Integer
TWO_MONTH
=
ONE_DAY
*
30
;
// 1 month
public
static
final
Integer
ONE_MONTH
=
ONE_DAY
*
30
;
// 1 month
public
static
final
Integer
TWO_MONTH
=
ONE_DAY
*
60
;
// 2 month
/**
* The number of seconds in one year (= 60 * 60 * 24 * 365).
*/
public
static
final
Integer
ONE_YEAR
=
60
*
60
*
24
*
365
;
String
id
;
...
...
maxkey-core/src/main/java/org/maxkey/constants/BOOLEAN.java
已删除
100644 → 0
浏览文件 @
2fb491b4
package
org.maxkey.constants
;
/**
* Define int for boolean
* 0 false
* 1 true
*
* @author Crystal.Sea
*
*/
public
class
BOOLEAN
{
public
final
static
int
FALSE
=
0
;
public
final
static
int
TRUE
=
1
;
private
int
value
=
FALSE
;
public
BOOLEAN
()
{
}
public
int
getValue
()
{
return
value
;
}
public
boolean
isValue
()
{
return
TRUE
==
value
;
}
public
void
setValue
(
int
value
)
{
this
.
value
=
value
;
}
public
static
boolean
isTrue
(
int
value
){
return
TRUE
==
value
;
}
public
static
boolean
isFalse
(
int
value
){
return
FALSE
==
value
;
}
}
maxkey-core/src/main/java/org/maxkey/constants/Boolean.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
/**
* Define int for boolean 0 false 1 true.
*
* @author Crystal.Sea
*
*/
public
class
Boolean
{
public
static
final
int
FALSE
=
0
;
public
static
final
int
TRUE
=
1
;
private
int
value
=
FALSE
;
public
Boolean
()
{
}
public
int
getValue
()
{
return
value
;
}
public
boolean
isValue
()
{
return
TRUE
==
value
;
}
public
void
setValue
(
int
value
)
{
this
.
value
=
value
;
}
public
static
boolean
isTrue
(
int
value
)
{
return
TRUE
==
value
;
}
public
static
boolean
isFalse
(
int
value
)
{
return
FALSE
==
value
;
}
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsEntryType.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
public
class
ConstantsEntryType
{
public
static
int
USERINFO_TYPE
=
1
;
public
static
int
ORG_TYPE
=
2
;
public
static
int
GROUP_TYPE
=
3
;
public
static
int
PASSWORD_TYPE
=
4
;
public
static
int
RESOURCES_TYPE
=
5
;
public
static
int
PERMISSIONS_TYPE
=
6
;
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsLoginType.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
public
class
ConstantsLoginType
{
public
static
final
String
LOCAL
=
"Local Login"
;
public
static
final
String
BASIC
=
"Basic"
;
public
static
final
String
SOCIALSIGNON
=
"Social Sign On"
;
public
static
final
String
REMEBER_ME
=
"RemeberMe"
;
public
static
final
String
DESKTOP
=
"Desktop"
;
public
static
final
String
KERBEROS
=
"Kerberos"
;
public
static
final
String
SAMLTRUST
=
"SAML v2.0 Trust"
;
public
static
final
String
MSADTRUST
=
"MS AD Trust"
;
public
static
final
String
CAS
=
"CAS"
;
public
static
final
String
WSFEDERATION
=
"WsFederation"
;
public
static
final
String
JWT
=
"Jwt"
;
public
static
final
String
HTTPHEADER
=
"HttpHeader"
;
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsOperateAction.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
public
final
class
ConstantsOperateAction
{
public
static
final
int
CREATE_ACTION
=
1
;
public
static
final
int
DELETE_ACTION
=
2
;
public
static
final
int
UPDATE_ACTION
=
3
;
public
static
final
int
CHANGE_PASSWORD_ACTION
=
4
;
public
static
final
int
ADD_MEMBER_ACTION
=
5
;
public
static
final
int
DELETE_MEMBER_ACTION
=
6
;
public
static
final
int
VIEW_ACTION
=
7
;
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsOperateMessage.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
public
final
class
ConstantsOperateMessage
{
public
static
final
String
INSERT_SUCCESS
=
"message.action.insert.success"
;
public
static
final
String
INSERT_ERROR
=
"message.action.insert.error"
;
public
static
final
String
UPDATE_SUCCESS
=
"message.action.update.success"
;
public
static
final
String
UPDATE_ERROR
=
"message.action.update.error"
;
public
static
final
String
DELETE_SUCCESS
=
"message.action.delete.success"
;
public
static
final
String
DELETE_ERROR
=
"message.action.delete.error"
;
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsPasswordSetType.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
/**
* PASSWORDSETTYPE.
* @author Crystal.Sea
*
*/
public
final
class
ConstantsPasswordSetType
{
public
static
final
int
PASSWORD_NORMAL
=
0
;
public
static
final
int
INITIAL_PASSWORD
=
1
;
public
static
final
int
MANAGER_CHANGED_PASSWORD
=
2
;
public
static
final
int
PASSWORD_EXPIRED
=
3
;
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsPlatformRole.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
public
final
class
ConstantsPlatformRole
{
public
static
final
String
PLATFORM_ADMIN
=
"PLATFORM_ADMIN"
;
public
static
final
String
TANANT_ADMIN
=
"TANANT_ADMIN"
;
public
static
final
String
ORDINARY_USER
=
"ORDINARY_USER"
;
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsProtocols.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
/**
* PROTOCOLS.
* @author Crystal.Sea
*
*/
public
final
class
ConstantsProtocols
{
public
static
final
String
DESKTOP
=
"Desktop"
;
public
static
final
String
BASIC
=
"Basic"
;
public
static
final
String
EXTEND_API
=
"Extend_API"
;
public
static
final
String
FORMBASED
=
"Form_Based"
;
public
static
final
String
TOKENBASED
=
"Token_Based"
;
// OAuth
public
static
final
String
OAUTH20
=
"OAuth_v2.0"
;
// SAML
public
static
final
String
SAML20
=
"SAML_v2.0"
;
public
static
final
String
OPEN_ID_CONNECT
=
"OpenID_Connect"
;
public
static
final
String
CAS
=
"CAS"
;
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsServiceMessage.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
public
final
class
ConstantsServiceMessage
{
public
static
final
class
EMPLOYEES
{
public
static
final
String
SERVICE_NAME
=
"employees"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XE00000004
=
"XE00000004"
;
public
static
final
String
XE00000005
=
"XE00000005"
;
public
static
final
String
XE00000006
=
"XE00000006"
;
public
static
final
String
XE00000007
=
"XE00000007"
;
public
static
final
String
XE00000008
=
"XE00000008"
;
public
static
final
String
XW00000001
=
"XW00000001"
;
public
static
final
String
XW00000002
=
"XW00000002"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
}
public
static
final
class
ENTERPRISES
{
public
static
final
String
SERVICE_NAME
=
"enterprises"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XE00000004
=
"XE00000004"
;
public
static
final
String
XE00000005
=
"XE00000005"
;
public
static
final
String
XE00000006
=
"XE00000006"
;
public
static
final
String
XE00000007
=
"XE00000007"
;
public
static
final
String
XE00000008
=
"XE00000008"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XS00000004
=
"XS00000004"
;
}
public
static
final
class
RETRIEVEPASSWORD
{
public
static
final
String
SERVICE_NAME
=
"retrievepassword"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
}
public
static
final
class
USERCENTER
{
public
static
final
String
SERVICE_NAME
=
"usercenter"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
}
public
static
final
class
APPLICATIONS
{
public
static
final
String
SERVICE_NAME
=
"applications"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XS00000004
=
"XS00000004"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XE00000004
=
"XE00000004"
;
}
public
static
final
class
APPROLES
{
public
static
final
String
SERVICE_NAME
=
"approles"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XE00000004
=
"XE00000004"
;
public
static
final
String
XS00000004
=
"XS00000004"
;
public
static
final
String
XS00000005
=
"XS00000005"
;
public
static
final
String
XE00000005
=
"XE00000005"
;
public
static
final
String
XE00000006
=
"XE00000006"
;
public
static
final
String
XS00000006
=
"XS00000006"
;
public
static
final
String
XE00000007
=
"XE00000007"
;
public
static
final
String
XS00000007
=
"XS00000007"
;
public
static
final
String
XS00000008
=
"XS00000008"
;
public
static
final
String
XE00000008
=
"XE00000008"
;
public
static
final
String
XE00000009
=
"XE00000009"
;
public
static
final
String
XS00000009
=
"XS00000009"
;
}
public
static
final
class
APIUSERS
{
public
static
final
String
SERVICE_NAME
=
"apiusers"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XW00000001
=
"XW00000001"
;
public
static
final
String
XW00000002
=
"XW00000002"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
}
public
static
final
class
PASSWORDPOLICY
{
public
static
final
String
SERVICE_NAME
=
"passwordpolicy"
;
public
static
final
String
XW00000002
=
"XW00000002"
;
public
static
final
String
XW00000001
=
"XW00000001"
;
public
static
final
String
XW00000003
=
"XW00000003"
;
public
static
final
String
XW00000004
=
"XW00000004"
;
public
static
final
String
XW00000005
=
"XW00000005"
;
public
static
final
String
XW00000006
=
"XW00000006"
;
public
static
final
String
XW00000007
=
"XW00000007"
;
public
static
final
String
XW00000008
=
"XW00000008"
;
}
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsStatus.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
public
final
class
ConstantsStatus
{
public
static
final
int
ACTIVE
=
1
;
public
static
final
int
INACTIVE
=
2
;
public
static
final
int
ENABLED
=
3
;
public
static
final
int
DISABLED
=
4
;
public
static
final
int
LOCK
=
5
;
public
static
final
int
UNLOCK
=
6
;
public
static
final
int
INVALID
=
7
;
public
static
final
int
EXPIRED
=
8
;
public
static
final
int
DELETE
=
9
;
public
static
final
int
VALIDATED
=
10
;
public
static
final
int
START
=
11
;
public
static
final
int
STOP
=
12
;
public
static
final
int
APPROVED
=
13
;
}
maxkey-core/src/main/java/org/maxkey/constants/ConstantsTimeInterval.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.constants
;
public
final
class
ConstantsTimeInterval
{
public
static
final
Integer
ONE_MINUTE
=
60
;
// 1 minutes
public
static
final
Integer
ONE_HOUR
=
60
*
60
;
// 1 hour
public
static
final
Integer
ONE_DAY
=
60
*
60
*
24
;
// 1 day
public
static
final
Integer
ONE_WEEK
=
ONE_DAY
*
7
;
// 1 week
public
static
final
Integer
TWO_WEEK
=
ONE_DAY
*
14
;
// 2 week
public
static
final
Integer
ONE_MONTH
=
ONE_DAY
*
30
;
// 1 month
public
static
final
Integer
TWO_MONTH
=
ONE_DAY
*
60
;
// 2 month
/**
* The number of seconds in one year (= 60 * 60 * 24 * 365).
*/
public
static
final
Integer
ONE_YEAR
=
60
*
60
*
24
*
365
;
}
maxkey-core/src/main/java/org/maxkey/constants/ENTRY_TYPE.java
已删除
100644 → 0
浏览文件 @
2fb491b4
package
org.maxkey.constants
;
public
class
ENTRY_TYPE
{
public
static
int
USERINFO_TYPE
=
1
;
public
static
int
ORG_TYPE
=
2
;
public
static
int
GROUP_TYPE
=
3
;
public
static
int
PASSWORD_TYPE
=
4
;
public
static
int
RESOURCES_TYPE
=
5
;
public
static
int
PERMISSIONS_TYPE
=
6
;
}
maxkey-core/src/main/java/org/maxkey/constants/LOGINTYPE.java
已删除
100644 → 0
浏览文件 @
2fb491b4
package
org.maxkey.constants
;
public
class
LOGINTYPE
{
public
static
final
String
LOCAL
=
"Local Login"
;
public
static
final
String
BASIC
=
"Basic"
;
public
static
final
String
SOCIALSIGNON
=
"Social Sign On"
;
public
static
final
String
REMEBER_ME
=
"RemeberMe"
;
public
static
final
String
DESKTOP
=
"Desktop"
;
public
static
final
String
KERBEROS
=
"Kerberos"
;
public
static
final
String
SAMLTRUST
=
"SAML v2.0 Trust"
;
public
static
final
String
MSADTRUST
=
"MS AD Trust"
;
public
static
final
String
CAS
=
"CAS"
;
public
static
final
String
WSFEDERATION
=
"WsFederation"
;
public
static
final
String
JWT
=
"Jwt"
;
public
static
final
String
HTTPHEADER
=
"HttpHeader"
;
}
maxkey-core/src/main/java/org/maxkey/constants/OPERATEACTION.java
已删除
100644 → 0
浏览文件 @
2fb491b4
package
org.maxkey.constants
;
public
final
class
OPERATEACTION
{
public
static
final
int
CREATE_ACTION
=
1
;
public
static
final
int
DELETE_ACTION
=
2
;
public
static
final
int
UPDATE_ACTION
=
3
;
public
static
final
int
CHANGE_PASSWORD_ACTION
=
4
;
public
static
final
int
ADD_MEMBER_ACTION
=
5
;
public
static
final
int
DELETE_MEMBER_ACTION
=
6
;
public
static
final
int
VIEW_ACTION
=
7
;
}
maxkey-core/src/main/java/org/maxkey/constants/OPERATEMESSAGE.java
已删除
100644 → 0
浏览文件 @
2fb491b4
package
org.maxkey.constants
;
public
final
class
OPERATEMESSAGE
{
public
static
final
String
INSERT_SUCCESS
=
"message.action.insert.success"
;
public
static
final
String
INSERT_ERROR
=
"message.action.insert.error"
;
public
static
final
String
UPDATE_SUCCESS
=
"message.action.update.success"
;
public
static
final
String
UPDATE_ERROR
=
"message.action.update.error"
;
public
static
final
String
DELETE_SUCCESS
=
"message.action.delete.success"
;
public
static
final
String
DELETE_ERROR
=
"message.action.delete.error"
;
}
maxkey-core/src/main/java/org/maxkey/constants/PASSWORDSETTYPE.java
已删除
100644 → 0
浏览文件 @
2fb491b4
/**
*
*/
package
org.maxkey.constants
;
/**
* @author Crystal.Sea
*
*/
public
final
class
PASSWORDSETTYPE
{
public
static
final
int
PASSWORD_NORMAL
=
0
;
public
static
final
int
INITIAL_PASSWORD
=
1
;
public
static
final
int
MANAGER_CHANGED_PASSWORD
=
2
;
public
static
final
int
PASSWORD_EXPIRED
=
3
;
}
maxkey-core/src/main/java/org/maxkey/constants/PLATFORMROLE.java
已删除
100644 → 0
浏览文件 @
2fb491b4
package
org.maxkey.constants
;
public
final
class
PLATFORMROLE
{
public
static
final
String
PLATFORM_ADMIN
=
"PLATFORM_ADMIN"
;
public
static
final
String
TANANT_ADMIN
=
"TANANT_ADMIN"
;
public
static
final
String
ORDINARY_USER
=
"ORDINARY_USER"
;
}
maxkey-core/src/main/java/org/maxkey/constants/PROTOCOLS.java
已删除
100644 → 0
浏览文件 @
2fb491b4
/**
*
*/
package
org.maxkey.constants
;
/**
* @author Crystal.Sea
*
*/
public
final
class
PROTOCOLS
{
public
static
final
String
DESKTOP
=
"Desktop"
;
public
static
final
String
BASIC
=
"Basic"
;
public
static
final
String
EXTEND_API
=
"Extend_API"
;
public
static
final
String
FORMBASED
=
"Form_Based"
;
public
static
final
String
TOKENBASED
=
"Token_Based"
;
//OAuth
public
static
final
String
OAUTH20
=
"OAuth_v2.0"
;
//SAML
public
static
final
String
SAML20
=
"SAML_v2.0"
;
public
static
final
String
OPEN_ID_CONNECT
=
"OpenID_Connect"
;
public
static
final
String
CAS
=
"CAS"
;
/**
*
*/
public
PROTOCOLS
()
{
}
}
maxkey-core/src/main/java/org/maxkey/constants/SERVICEMESSAGE.java
已删除
100644 → 0
浏览文件 @
2fb491b4
package
org.maxkey.constants
;
public
final
class
SERVICEMESSAGE
{
public
static
final
class
EMPLOYEES
{
public
static
final
String
SERVICE_NAME
=
"employees"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XE00000004
=
"XE00000004"
;
public
static
final
String
XE00000005
=
"XE00000005"
;
public
static
final
String
XE00000006
=
"XE00000006"
;
public
static
final
String
XE00000007
=
"XE00000007"
;
public
static
final
String
XE00000008
=
"XE00000008"
;
public
static
final
String
XW00000001
=
"XW00000001"
;
public
static
final
String
XW00000002
=
"XW00000002"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
}
public
static
final
class
ENTERPRISES
{
public
static
final
String
SERVICE_NAME
=
"enterprises"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XE00000004
=
"XE00000004"
;
public
static
final
String
XE00000005
=
"XE00000005"
;
public
static
final
String
XE00000006
=
"XE00000006"
;
public
static
final
String
XE00000007
=
"XE00000007"
;
public
static
final
String
XE00000008
=
"XE00000008"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XS00000004
=
"XS00000004"
;
}
public
static
final
class
RETRIEVEPASSWORD
{
public
static
final
String
SERVICE_NAME
=
"retrievepassword"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
}
public
static
final
class
USERCENTER
{
public
static
final
String
SERVICE_NAME
=
"usercenter"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
}
public
static
final
class
APPLICATIONS
{
public
static
final
String
SERVICE_NAME
=
"applications"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XS00000004
=
"XS00000004"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XE00000004
=
"XE00000004"
;
}
public
static
final
class
APPROLES
{
public
static
final
String
SERVICE_NAME
=
"approles"
;
public
static
final
String
XE00000002
=
"XE00000002"
;
public
static
final
String
XS00000002
=
"XS00000002"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XE00000004
=
"XE00000004"
;
public
static
final
String
XS00000004
=
"XS00000004"
;
public
static
final
String
XS00000005
=
"XS00000005"
;
public
static
final
String
XE00000005
=
"XE00000005"
;
public
static
final
String
XE00000006
=
"XE00000006"
;
public
static
final
String
XS00000006
=
"XS00000006"
;
public
static
final
String
XE00000007
=
"XE00000007"
;
public
static
final
String
XS00000007
=
"XS00000007"
;
public
static
final
String
XS00000008
=
"XS00000008"
;
public
static
final
String
XE00000008
=
"XE00000008"
;
public
static
final
String
XE00000009
=
"XE00000009"
;
public
static
final
String
XS00000009
=
"XS00000009"
;
}
public
static
final
class
APIUSERS
{
public
static
final
String
SERVICE_NAME
=
"apiusers"
;
public
static
final
String
XS00000003
=
"XS00000003"
;
public
static
final
String
XE00000003
=
"XE00000003"
;
public
static
final
String
XW00000001
=
"XW00000001"
;
public
static
final
String
XW00000002
=
"XW00000002"
;
public
static
final
String
XS00000001
=
"XS00000001"
;
public
static
final
String
XE00000001
=
"XE00000001"
;
}
public
static
final
class
PASSWORDPOLICY
{
public
static
final
String
SERVICE_NAME
=
"passwordpolicy"
;
public
static
final
String
XW00000002
=
"XW00000002"
;
public
static
final
String
XW00000001
=
"XW00000001"
;
public
static
final
String
XW00000003
=
"XW00000003"
;
public
static
final
String
XW00000004
=
"XW00000004"
;
public
static
final
String
XW00000005
=
"XW00000005"
;
public
static
final
String
XW00000006
=
"XW00000006"
;
public
static
final
String
XW00000007
=
"XW00000007"
;
public
static
final
String
XW00000008
=
"XW00000008"
;
}
}
maxkey-core/src/main/java/org/maxkey/constants/STATUS.java
已删除
100644 → 0
浏览文件 @
2fb491b4
package
org.maxkey.constants
;
public
final
class
STATUS
{
public
static
final
int
ACTIVE
=
1
;
public
static
final
int
INACTIVE
=
2
;
public
static
final
int
ENABLED
=
3
;
public
static
final
int
DISABLED
=
4
;
public
static
final
int
LOCK
=
5
;
public
static
final
int
UNLOCK
=
6
;
public
static
final
int
INVALID
=
7
;
public
static
final
int
EXPIRED
=
8
;
public
static
final
int
DELETE
=
9
;
public
static
final
int
VALIDATED
=
10
;
public
static
final
int
START
=
11
;
public
static
final
int
STOP
=
12
;
public
static
final
int
APPROVED
=
13
;
}
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/AbstractOptAuthn.java
浏览文件 @
f3b799e7
package
org.maxkey.crypto.password.opt
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Types
;
import
java.util.Date
;
import
org.joda.time.DateTime
;
import
org.joda.time.Duration
;
import
org.joda.time.format.DateTimeFormat
;
import
org.maxkey.constants.STATUS
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.util.StringGenerator
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
/**
* AbstractOTPAuthn.
...
...
@@ -31,8 +21,6 @@ public abstract class AbstractOptAuthn {
StringGenerator
stringGenerator
;
private
final
JdbcTemplate
jdbcTemplate
;
public
static
final
class
OptTypes
{
// 手机
public
static
int
MOBILE
=
2
;
...
...
@@ -51,19 +39,6 @@ public abstract class AbstractOptAuthn {
}
private
static
final
String
DEFAULT_DEFAULT_INSERT_STATEMENT
=
"INSERT INTO ONE_TIME_PASSWORD(ID ,OPTTYPE,USERNAME,TOKEN,RECEIVER,CREATETIME,STATUS)"
+
" VALUES(?,?,?,?,?,?,"
+
STATUS
.
ACTIVE
+
")"
;
private
static
final
String
DEFAULT_DEFAULT_SELECT_STATEMENT
=
"SELECT ID ,OPTTYPE,USERNAME,TOKEN,RECEIVER,CREATETIME FROM ONE_TIME_PASSWORD"
+
" WHERE STATUS ="
+
STATUS
.
ACTIVE
+
" AND USERNAME = ? AND TOKEN = ? AND OPTTYPE = ?"
;
private
static
final
String
DEFAULT_DEFAULT_DELETE_STATEMENT
=
"UPDATE ONE_TIME_PASSWORD SET STATUS ="
+
STATUS
.
DELETE
+
" WHERE USERNAME = ? AND TOKEN = ? AND OPTTYPE = ?"
;
public
abstract
boolean
produce
(
UserInfo
userInfo
);
public
abstract
boolean
validate
(
UserInfo
userInfo
,
String
token
);
...
...
@@ -81,62 +56,9 @@ public abstract class AbstractOptAuthn {
if
(
stringGenerator
==
null
)
{
stringGenerator
=
new
StringGenerator
(
StringGenerator
.
DEFAULT_CODE_NUMBER
,
digits
);
}
return
stringGenerator
.
randomGenerate
();
}
public
AbstractOptAuthn
(
JdbcTemplate
jdbcTemplate
)
{
this
.
jdbcTemplate
=
jdbcTemplate
;
}
protected
void
insertDataBase
(
UserInfo
userInfo
,
String
token
,
String
receiver
,
int
type
)
{
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_INSERT_STATEMENT
,
new
Object
[]
{
java
.
util
.
UUID
.
randomUUID
(),
type
,
userInfo
.
getUsername
(),
token
,
receiver
,
new
Date
()
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
INTEGER
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
TIMESTAMP
}
);
}
/**
* validateDataBase.
* @param userInfo UserInfo
* @param token String
* @param type int
* @return
*/
public
boolean
validateDataBase
(
UserInfo
userInfo
,
String
token
,
int
type
)
{
OneTimePassword
oneTimePassword
=
jdbcTemplate
.
queryForObject
(
DEFAULT_DEFAULT_SELECT_STATEMENT
,
new
OneTimePasswordRowMapper
(),
userInfo
.
getUsername
(),
token
,
type
);
if
(
oneTimePassword
!=
null
)
{
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_DELETE_STATEMENT
,
new
Object
[]
{
userInfo
.
getUsername
(),
token
,
type
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
INTEGER
}
);
DateTime
currentdateTime
=
new
DateTime
();
DateTime
oneTimePwdData
=
DateTime
.
parse
(
oneTimePassword
.
getCreateTime
(),
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
));
Duration
duration
=
new
Duration
(
oneTimePwdData
,
currentdateTime
);
int
intDuration
=
Integer
.
parseInt
(
duration
.
getStandardSeconds
()
+
""
);
logger
.
debug
(
"validate duration "
+
intDuration
);
logger
.
debug
(
"validate result "
+
(
intDuration
<=
interval
));
if
(
intDuration
<=
interval
)
{
return
true
;
}
}
return
false
;
String
token
=
stringGenerator
.
randomGenerate
();
logger
.
debug
(
"Generator token "
+
token
);
return
token
;
}
/**
...
...
@@ -187,22 +109,5 @@ public abstract class AbstractOptAuthn {
this
.
crypto
=
crypto
;
}
public
class
OneTimePasswordRowMapper
implements
RowMapper
<
OneTimePassword
>
{
/**
*ResultSet.
*/
public
OneTimePassword
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
OneTimePassword
oneTimePassword
=
new
OneTimePassword
();
oneTimePassword
.
setId
(
rs
.
getString
(
"ID"
));
oneTimePassword
.
setType
(
rs
.
getInt
(
"OPTTYPE"
));
oneTimePassword
.
setUsername
(
rs
.
getString
(
"USERNAME"
));
oneTimePassword
.
setToken
(
rs
.
getString
(
"TOKEN"
));
oneTimePassword
.
setUsername
(
rs
.
getString
(
"USERNAME"
));
oneTimePassword
.
setReceiver
(
rs
.
getString
(
"RECEIVER"
));
oneTimePassword
.
setCreateTime
(
rs
.
getString
(
"CREATETIME"
));
return
oneTimePassword
;
}
}
}
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/CapOtpAuthn.java
浏览文件 @
f3b799e7
...
...
@@ -2,7 +2,6 @@ package org.maxkey.crypto.password.opt.impl;
import
org.maxkey.crypto.password.opt.AbstractOptAuthn
;
import
org.maxkey.domain.UserInfo
;
import
org.springframework.jdbc.core.JdbcTemplate
;
/**
* Chip Authentication Program EMV stands for Europay, MasterCard and Visa, a
...
...
@@ -16,10 +15,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
*/
public
class
CapOtpAuthn
extends
AbstractOptAuthn
{
public
CapOtpAuthn
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
}
@Override
public
boolean
produce
(
UserInfo
userInfo
)
{
// TODO Auto-generated method stub
...
...
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/CounterBasedOtpAuthn.java
浏览文件 @
f3b799e7
...
...
@@ -7,14 +7,10 @@ import org.maxkey.crypto.password.opt.algorithm.TimeBasedOTP;
import
org.maxkey.domain.UserInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
public
class
CounterBasedOtpAuthn
extends
AbstractOptAuthn
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
CounterBasedOtpAuthn
.
class
);
public
CounterBasedOtpAuthn
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
}
@Override
public
boolean
produce
(
UserInfo
userInfo
)
{
...
...
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/HotpOtpAuthn.java
浏览文件 @
f3b799e7
...
...
@@ -8,7 +8,6 @@ import org.maxkey.crypto.password.opt.algorithm.HOTP;
import
org.maxkey.domain.UserInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
public
class
HotpOtpAuthn
extends
AbstractOptAuthn
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
HotpOtpAuthn
.
class
);
...
...
@@ -16,10 +15,6 @@ public class HotpOtpAuthn extends AbstractOptAuthn {
boolean
addChecksum
;
int
truncation
=
-
1
;
public
HotpOtpAuthn
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
}
@Override
public
boolean
produce
(
UserInfo
userInfo
)
{
return
true
;
...
...
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/MailOtpAuthn.java
浏览文件 @
f3b799e7
...
...
@@ -8,16 +8,11 @@ import org.maxkey.crypto.password.opt.AbstractOptAuthn;
import
org.maxkey.domain.UserInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
public
class
MailOtpAuthn
extends
AbstractOptAuthn
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
MailOtpAuthn
.
class
);
EmailConfig
emailConfig
;
public
MailOtpAuthn
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
}
@Override
public
boolean
produce
(
UserInfo
userInfo
)
{
try
{
...
...
@@ -37,7 +32,7 @@ public class MailOtpAuthn extends AbstractOptAuthn {
_logger
.
debug
(
"token "
+
token
+
" send to user +"
+
userInfo
.
getUsername
()
+
", email "
+
userInfo
.
getEmail
());
this
.
insertDataBase
(
userInfo
,
token
,
userInfo
.
getUsername
(),
OptTypes
.
EMAIL
);
//
this.insertDataBase(userInfo, token, userInfo.getUsername(), OptTypes.EMAIL);
return
true
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -47,7 +42,7 @@ public class MailOtpAuthn extends AbstractOptAuthn {
@Override
public
boolean
validate
(
UserInfo
userInfo
,
String
token
)
{
return
t
his
.
validateDataBase
(
userInfo
,
token
,
OptTypes
.
EMAIL
)
;
return
t
rue
;
}
public
void
setEmailConfig
(
EmailConfig
emailConfig
)
{
...
...
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/MobileOtpAuthn.java
浏览文件 @
f3b799e7
...
...
@@ -2,14 +2,9 @@ package org.maxkey.crypto.password.opt.impl;
import
org.maxkey.crypto.password.opt.AbstractOptAuthn
;
import
org.maxkey.domain.UserInfo
;
import
org.springframework.jdbc.core.JdbcTemplate
;
public
class
MobileOtpAuthn
extends
AbstractOptAuthn
{
public
MobileOtpAuthn
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
}
@Override
public
boolean
produce
(
UserInfo
userInfo
)
{
// TODO Auto-generated method stub
...
...
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/RsaOtpAuthn.java
浏览文件 @
f3b799e7
...
...
@@ -2,7 +2,6 @@ package org.maxkey.crypto.password.opt.impl;
import
org.maxkey.crypto.password.opt.AbstractOptAuthn
;
import
org.maxkey.domain.UserInfo
;
import
org.springframework.jdbc.core.JdbcTemplate
;
/**
* Chip Authentication Program EMV stands for Europay, MasterCard and Visa, a
...
...
@@ -16,10 +15,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
*/
public
class
RsaOtpAuthn
extends
AbstractOptAuthn
{
public
RsaOtpAuthn
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
}
@Override
public
boolean
produce
(
UserInfo
userInfo
)
{
// TODO Auto-generated method stub
...
...
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/SmsOtpAuthn.java
浏览文件 @
f3b799e7
...
...
@@ -2,26 +2,20 @@ package org.maxkey.crypto.password.opt.impl;
import
org.maxkey.crypto.password.opt.AbstractOptAuthn
;
import
org.maxkey.domain.UserInfo
;
import
org.springframework.jdbc.core.JdbcTemplate
;
public
class
SmsOtpAuthn
extends
AbstractOptAuthn
{
public
SmsOtpAuthn
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
}
@Override
public
boolean
produce
(
UserInfo
userInfo
)
{
String
token
=
this
.
genToken
(
userInfo
);
// TODO:You must add send sms code here
this
.
insertDataBase
(
userInfo
,
token
,
userInfo
.
getUsername
(),
OptTypes
.
SMS
);
return
true
;
}
@Override
public
boolean
validate
(
UserInfo
userInfo
,
String
token
)
{
return
t
his
.
validateDataBase
(
userInfo
,
token
,
OptTypes
.
SMS
)
;
return
t
rue
;
}
}
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/TimeBasedOtpAuthn.java
浏览文件 @
f3b799e7
...
...
@@ -11,14 +11,12 @@ import org.maxkey.crypto.password.opt.algorithm.TimeBasedOTP;
import
org.maxkey.domain.UserInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
public
class
TimeBasedOtpAuthn
extends
AbstractOptAuthn
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
TimeBasedOtpAuthn
.
class
);
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
public
TimeBasedOtpAuthn
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
public
TimeBasedOtpAuthn
()
{
dateFormat
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
}
...
...
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/impl/sms/netease/SmsOtpAuthnYunxin.java
浏览文件 @
f3b799e7
...
...
@@ -12,7 +12,6 @@ import org.apache.http.impl.client.HttpClientBuilder;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.util.EntityUtils
;
import
org.maxkey.crypto.password.opt.impl.SmsOtpAuthn
;
import
org.springframework.jdbc.core.JdbcTemplate
;
/**
* 网易云信的短信验证.
...
...
@@ -21,9 +20,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
*/
public
class
SmsOtpAuthnYunxin
extends
SmsOtpAuthn
{
public
SmsOtpAuthnYunxin
(
JdbcTemplate
jdbcTemplate
)
{
super
(
jdbcTemplate
);
// TODO Auto-generated constructor stub
public
SmsOtpAuthnYunxin
()
{
}
//发送验证码的请求路径URL
...
...
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/token/AbstractOptTokenStore.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.crypto.password.opt.token
;
public
class
AbstractOptTokenStore
{
}
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/token/InMemoryOptTokenStore.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.crypto.password.opt.token
;
import
java.time.Duration
;
import
org.ehcache.UserManagedCache
;
import
org.ehcache.config.builders.ExpiryPolicyBuilder
;
import
org.ehcache.config.builders.UserManagedCacheBuilder
;
import
org.maxkey.authn.support.rememberme.RemeberMe
;
import
org.maxkey.crypto.password.opt.OneTimePassword
;
public
class
InMemoryOptTokenStore
{
protected
static
final
UserManagedCache
<
String
,
OneTimePassword
>
remeberMeStore
=
UserManagedCacheBuilder
.
newUserManagedCacheBuilder
(
String
.
class
,
OneTimePassword
.
class
)
.
withExpiry
(
ExpiryPolicyBuilder
.
timeToLiveExpiration
(
Duration
.
ofMinutes
(
RemeberMe
.
TWO_WEEK
)
)
)
.
build
(
true
);
}
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/token/JdbcOptTokenStore.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.crypto.password.opt.token
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Types
;
import
java.util.Date
;
import
org.joda.time.DateTime
;
import
org.joda.time.Duration
;
import
org.joda.time.format.DateTimeFormat
;
import
org.maxkey.constants.ConstantsStatus
;
import
org.maxkey.crypto.password.opt.OneTimePassword
;
import
org.maxkey.domain.UserInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
public
class
JdbcOptTokenStore
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JdbcOptTokenStore
.
class
);
private
static
final
String
DEFAULT_DEFAULT_INSERT_STATEMENT
=
"INSERT INTO ONE_TIME_PASSWORD(ID ,OPTTYPE,USERNAME,TOKEN,RECEIVER,CREATETIME,STATUS)"
+
" VALUES(?,?,?,?,?,?,"
+
ConstantsStatus
.
ACTIVE
+
")"
;
private
static
final
String
DEFAULT_DEFAULT_SELECT_STATEMENT
=
"SELECT ID ,OPTTYPE,USERNAME,TOKEN,RECEIVER,CREATETIME FROM ONE_TIME_PASSWORD"
+
" WHERE STATUS ="
+
ConstantsStatus
.
ACTIVE
+
" AND USERNAME = ? AND TOKEN = ? AND OPTTYPE = ?"
;
private
static
final
String
DEFAULT_DEFAULT_DELETE_STATEMENT
=
"UPDATE ONE_TIME_PASSWORD SET STATUS ="
+
ConstantsStatus
.
DELETE
+
" WHERE USERNAME = ? AND TOKEN = ? AND OPTTYPE = ?"
;
private
final
JdbcTemplate
jdbcTemplate
;
public
JdbcOptTokenStore
(
JdbcTemplate
jdbcTemplate
)
{
this
.
jdbcTemplate
=
jdbcTemplate
;
}
protected
void
store
(
UserInfo
userInfo
,
String
token
,
String
receiver
,
int
type
)
{
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_INSERT_STATEMENT
,
new
Object
[]
{
java
.
util
.
UUID
.
randomUUID
(),
type
,
userInfo
.
getUsername
(),
token
,
receiver
,
new
Date
()
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
INTEGER
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
TIMESTAMP
}
);
}
/**
* validate.
* @param userInfo UserInfo
* @param token String
* @param type int
* @return
*/
public
boolean
validate
(
UserInfo
userInfo
,
String
token
,
int
type
,
int
interval
)
{
OneTimePassword
oneTimePassword
=
jdbcTemplate
.
queryForObject
(
DEFAULT_DEFAULT_SELECT_STATEMENT
,
new
OneTimePasswordRowMapper
(),
userInfo
.
getUsername
(),
token
,
type
);
if
(
oneTimePassword
!=
null
)
{
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_DELETE_STATEMENT
,
new
Object
[]
{
userInfo
.
getUsername
(),
token
,
type
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
INTEGER
}
);
DateTime
currentdateTime
=
new
DateTime
();
DateTime
oneTimePwdData
=
DateTime
.
parse
(
oneTimePassword
.
getCreateTime
(),
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
));
Duration
duration
=
new
Duration
(
oneTimePwdData
,
currentdateTime
);
int
intDuration
=
Integer
.
parseInt
(
duration
.
getStandardSeconds
()
+
""
);
logger
.
debug
(
"validate duration "
+
intDuration
);
logger
.
debug
(
"validate result "
+
(
intDuration
<=
interval
));
if
(
intDuration
<=
interval
)
{
return
true
;
}
}
return
false
;
}
public
class
OneTimePasswordRowMapper
implements
RowMapper
<
OneTimePassword
>
{
/**
*ResultSet.
*/
public
OneTimePassword
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
OneTimePassword
oneTimePassword
=
new
OneTimePassword
();
oneTimePassword
.
setId
(
rs
.
getString
(
"ID"
));
oneTimePassword
.
setType
(
rs
.
getInt
(
"OPTTYPE"
));
oneTimePassword
.
setUsername
(
rs
.
getString
(
"USERNAME"
));
oneTimePassword
.
setToken
(
rs
.
getString
(
"TOKEN"
));
oneTimePassword
.
setUsername
(
rs
.
getString
(
"USERNAME"
));
oneTimePassword
.
setReceiver
(
rs
.
getString
(
"RECEIVER"
));
oneTimePassword
.
setCreateTime
(
rs
.
getString
(
"CREATETIME"
));
return
oneTimePassword
;
}
}
}
maxkey-core/src/main/java/org/maxkey/crypto/password/opt/token/RedisOptTokenStore.java
0 → 100644
浏览文件 @
f3b799e7
package
org.maxkey.crypto.password.opt.token
;
public
class
RedisOptTokenStore
{
}
maxkey-core/src/main/java/org/maxkey/domain/PasswordPolicy.java
浏览文件 @
f3b799e7
...
...
@@ -6,9 +6,8 @@ import javax.persistence.GenerationType;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotNull
;
import
org.apache.mybatis.jpa.persistence.JpaBaseDomain
;
import
org.maxkey.constants.
SERVICEMESSAGE
;
import
org.maxkey.constants.
ConstantsServiceMessage
;
import
org.maxkey.exception.PasswordPolicyException
;
/**
...
...
@@ -22,7 +21,7 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
private
static
final
long
serialVersionUID
=
-
4797776994287829182L
;
@Id
@Column
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
,
generator
=
"uuid"
)
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
,
generator
=
"uuid"
)
String
id
;
/**
* minimum password lengths
...
...
@@ -79,8 +78,7 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
private
int
expiration
;
/**
* 0 no
* 1 yes
* 0 no 1 yes
*/
@Column
private
int
username
;
...
...
@@ -91,8 +89,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
@Column
private
String
simplePasswords
;
/**
* @return the minLength
*/
...
...
@@ -100,8 +96,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
minLength
;
}
/**
* @param minLength the minLength to set
*/
...
...
@@ -109,8 +103,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
minLength
=
minLength
;
}
/**
* @return the maxLength
*/
...
...
@@ -118,8 +110,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
maxLength
;
}
/**
* @param maxLength the maxLength to set
*/
...
...
@@ -127,7 +117,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
maxLength
=
maxLength
;
}
/**
* @return the lowerCase
*/
...
...
@@ -135,8 +124,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
lowerCase
;
}
/**
* @param lowerCase the lowerCase to set
*/
...
...
@@ -144,8 +131,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
lowerCase
=
lowerCase
;
}
/**
* @return the upperCase
*/
...
...
@@ -153,8 +138,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
upperCase
;
}
/**
* @param upperCase the upperCase to set
*/
...
...
@@ -162,8 +145,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
upperCase
=
upperCase
;
}
/**
* @return the digits
*/
...
...
@@ -171,8 +152,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
digits
;
}
/**
* @param digits the digits to set
*/
...
...
@@ -180,8 +159,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
digits
=
digits
;
}
/**
* @return the specialChar
*/
...
...
@@ -189,8 +166,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
specialChar
;
}
/**
* @return the id
*/
...
...
@@ -198,8 +173,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
id
;
}
/**
* @param id the id to set
*/
...
...
@@ -207,8 +180,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
id
=
id
;
}
/**
* @param specialChar the specialChar to set
*/
...
...
@@ -216,8 +187,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
specialChar
=
specialChar
;
}
/**
* @return the attempts
*/
...
...
@@ -225,8 +194,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
attempts
;
}
/**
* @param attempts the attempts to set
*/
...
...
@@ -234,11 +201,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
attempts
=
attempts
;
}
/**
* @return the duration
*/
...
...
@@ -246,8 +208,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
duration
;
}
/**
* @param duration the duration to set
*/
...
...
@@ -255,8 +215,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
duration
=
duration
;
}
/**
* @return the expiration
*/
...
...
@@ -264,8 +222,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
expiration
;
}
/**
* @param expiration the expiration to set
*/
...
...
@@ -273,8 +229,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
expiration
=
expiration
;
}
/**
* @return the username
*/
...
...
@@ -282,8 +236,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
username
;
}
/**
* @param username the username to set
*/
...
...
@@ -291,8 +243,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
username
=
username
;
}
/**
* @return the simplePasswords
*/
...
...
@@ -300,8 +250,6 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
return
simplePasswords
;
}
/**
* @param simplePasswords the simplePasswords to set
*/
...
...
@@ -309,28 +257,18 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
this
.
simplePasswords
=
simplePasswords
;
}
public
void
check
(
String
username
,
String
newPassword
,
String
oldPassword
)
throws
PasswordPolicyException
{
if
((
1
==
this
.
getUsername
())
&&
newPassword
.
toLowerCase
().
contains
(
username
.
toLowerCase
())){
throw
new
PasswordPolicyException
(
SERVICEMESSAGE
.
PASSWORDPOLICY
.
XW00000001
);
public
void
check
(
String
username
,
String
newPassword
,
String
oldPassword
)
throws
PasswordPolicyException
{
if
((
1
==
this
.
getUsername
())
&&
newPassword
.
toLowerCase
().
contains
(
username
.
toLowerCase
()))
{
throw
new
PasswordPolicyException
(
ConstantsServiceMessage
.
PASSWORDPOLICY
.
XW00000001
);
}
if
(
oldPassword
!=
null
&&
newPassword
.
equalsIgnoreCase
(
oldPassword
)){
throw
new
PasswordPolicyException
(
SERVICEMESSAGE
.
PASSWORDPOLICY
.
XW00000002
);
if
(
oldPassword
!=
null
&&
newPassword
.
equalsIgnoreCase
(
oldPassword
))
{
throw
new
PasswordPolicyException
(
ConstantsServiceMessage
.
PASSWORDPOLICY
.
XW00000002
);
}
if
(
newPassword
.
length
()
<
this
.
getMinLength
())
{
throw
new
PasswordPolicyException
(
SERVICEMESSAGE
.
PASSWORDPOLICY
.
XW00000003
,
this
.
getMinLength
());
throw
new
PasswordPolicyException
(
ConstantsServiceMessage
.
PASSWORDPOLICY
.
XW00000003
,
this
.
getMinLength
());
}
if
(
newPassword
.
length
()
>
this
.
getMaxLength
())
{
throw
new
PasswordPolicyException
(
SERVICEMESSAGE
.
PASSWORDPOLICY
.
XW00000004
,
this
.
getMaxLength
());
throw
new
PasswordPolicyException
(
ConstantsServiceMessage
.
PASSWORDPOLICY
.
XW00000004
,
this
.
getMaxLength
());
}
int
numCount
=
0
,
upperCount
=
0
,
lowerCount
=
0
,
spacil
=
0
;
char
[]
chPwd
=
newPassword
.
toCharArray
();
...
...
@@ -340,52 +278,41 @@ public class PasswordPolicy extends JpaBaseDomain implements java.io.Serializabl
numCount
++;
continue
;
}
if
(
Character
.
isLowerCase
(
ch
))
{
if
(
Character
.
isLowerCase
(
ch
))
{
lowerCount
++;
continue
;
}
if
(
Character
.
isUpperCase
(
ch
))
{
if
(
Character
.
isUpperCase
(
ch
))
{
upperCount
++;
continue
;
}
spacil
++;
}
if
(
numCount
<
this
.
getDigits
()){
throw
new
PasswordPolicyException
(
SERVICEMESSAGE
.
PASSWORDPOLICY
.
XW00000005
,
this
.
getDigits
());
if
(
numCount
<
this
.
getDigits
())
{
throw
new
PasswordPolicyException
(
ConstantsServiceMessage
.
PASSWORDPOLICY
.
XW00000005
,
this
.
getDigits
());
}
if
(
lowerCount
<
this
.
getLowerCase
()){
throw
new
PasswordPolicyException
(
SERVICEMESSAGE
.
PASSWORDPOLICY
.
XW00000006
,
this
.
getLowerCase
());
if
(
lowerCount
<
this
.
getLowerCase
())
{
throw
new
PasswordPolicyException
(
ConstantsServiceMessage
.
PASSWORDPOLICY
.
XW00000006
,
this
.
getLowerCase
());
}
if
(
upperCount
<
this
.
getUpperCase
()){
throw
new
PasswordPolicyException
(
SERVICEMESSAGE
.
PASSWORDPOLICY
.
XW00000007
,
this
.
getUpperCase
());
if
(
upperCount
<
this
.
getUpperCase
())
{
throw
new
PasswordPolicyException
(
ConstantsServiceMessage
.
PASSWORDPOLICY
.
XW00000007
,
this
.
getUpperCase
());
}
if
(
spacil
<
this
.
getSpecialChar
()){
throw
new
PasswordPolicyException
(
SERVICEMESSAGE
.
PASSWORDPOLICY
.
XW00000008
,
this
.
getSpecialChar
());
if
(
spacil
<
this
.
getSpecialChar
())
{
throw
new
PasswordPolicyException
(
ConstantsServiceMessage
.
PASSWORDPOLICY
.
XW00000008
,
this
.
getSpecialChar
());
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public
String
toString
()
{
return
"PasswordPolicy [minLength="
+
minLength
+
", maxLength="
+
maxLength
+
", lowerCase="
+
lowerCase
+
", upperCase="
+
upperCase
+
", digits="
+
digits
+
", specialChar="
+
specialChar
+
", attempts="
+
attempts
+
", duration="
+
duration
+
", expiration="
+
expiration
+
", username="
+
username
+
", simplePasswords="
+
simplePasswords
+
"]"
;
return
"PasswordPolicy [minLength="
+
minLength
+
", maxLength="
+
maxLength
+
", lowerCase="
+
lowerCase
+
", upperCase="
+
upperCase
+
", digits="
+
digits
+
", specialChar="
+
specialChar
+
", attempts="
+
attempts
+
", duration="
+
duration
+
", expiration="
+
expiration
+
", username="
+
username
+
", simplePasswords="
+
simplePasswords
+
"]"
;
}
}
maxkey-core/src/main/java/org/maxkey/domain/apps/Apps.java
浏览文件 @
f3b799e7
...
...
@@ -10,7 +10,7 @@ import javax.persistence.Id;
import
javax.persistence.Table
;
import
org.apache.mybatis.jpa.persistence.JpaBaseDomain
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.domain.Accounts
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -133,7 +133,7 @@ public class Apps extends JpaBaseDomain implements Serializable{
public
Apps
()
{
super
();
isSignature
=
B
OOLEAN
.
FALSE
;
isSignature
=
B
oolean
.
FALSE
;
credential
=
CREDENTIALS
.
NONE
;
}
...
...
maxkey-dao/src/main/java/org/maxkey/dao/service/MyProfileService.java
浏览文件 @
f3b799e7
package
org.maxkey.dao.service
;
import
org.apache.mybatis.jpa.persistence.JpaBaseService
;
import
org.maxkey.constants.OPERATEACTION
;
import
org.maxkey.dao.persistence.MyProfileMapper
;
import
org.maxkey.domain.UserInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
maxkey-dao/src/main/java/org/maxkey/dao/service/UserInfoService.java
浏览文件 @
f3b799e7
...
...
@@ -2,7 +2,7 @@ package org.maxkey.dao.service;
import
org.apache.mybatis.jpa.persistence.JpaBaseService
;
import
org.maxkey.constants.
STATUS
;
import
org.maxkey.constants.
ConstantsStatus
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.dao.persistence.UserInfoMapper
;
...
...
@@ -154,7 +154,7 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
public
void
locked
(
UserInfo
userInfo
)
{
try
{
if
(
userInfo
!=
null
&&
StringUtils
.
isNotEmpty
(
userInfo
.
getId
()))
{
userInfo
.
setIsLocked
(
STATUS
.
STOP
);
userInfo
.
setIsLocked
(
ConstantsStatus
.
STOP
);
getMapper
().
locked
(
userInfo
);
}
}
catch
(
Exception
e
)
{
...
...
@@ -169,7 +169,7 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
public
void
unlock
(
UserInfo
userInfo
)
{
try
{
if
(
userInfo
!=
null
&&
StringUtils
.
isNotEmpty
(
userInfo
.
getId
()))
{
userInfo
.
setIsLocked
(
STATUS
.
START
);
userInfo
.
setIsLocked
(
ConstantsStatus
.
START
);
userInfo
.
setBadPasswordCount
(
0
);
getMapper
().
unlock
(
userInfo
);
}
...
...
maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/AuthorizeEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -6,7 +6,7 @@ package org.maxkey.authz.endpoint;
import
javax.servlet.http.HttpServletRequest
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.dao.service.AppsCasDetailsService
;
import
org.maxkey.domain.apps.Apps
;
import
org.maxkey.web.WebConstants
;
...
...
@@ -37,23 +37,23 @@ public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
Apps
application
=
getApp
(
id
);
WebContext
.
setAttribute
(
WebConstants
.
SINGLE_SIGN_ON_APP_ID
,
id
);
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
EXTEND_API
)){
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
EXTEND_API
)){
modelAndView
=
WebContext
.
forward
(
"/authz/api/"
+
id
);
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
FORMBASED
)){
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
FORMBASED
)){
modelAndView
=
WebContext
.
forward
(
"/authz/formbased/"
+
id
);
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
OAUTH20
)){
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
OAUTH20
)){
modelAndView
=
WebContext
.
forward
(
"/authz/oauthv20/"
+
application
.
getId
());
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
OPEN_ID_CONNECT
)){
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
OPEN_ID_CONNECT
)){
// modelAndView=new ModelAndView("openid connect");
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
SAML20
)){
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
SAML20
)){
modelAndView
=
WebContext
.
forward
(
"/authz/saml20/idpinit/"
+
application
.
getId
());
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
TOKENBASED
)){
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
TOKENBASED
)){
modelAndView
=
WebContext
.
forward
(
"/authz/tokenbased/"
+
id
);
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
CAS
)){
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
CAS
)){
modelAndView
=
WebContext
.
forward
(
"/authz/cas/"
+
id
);
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
DESKTOP
)){
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
DESKTOP
)){
modelAndView
=
WebContext
.
forward
(
"/authz/desktop/"
+
id
);
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
PROTOCOLS
.
BASIC
)){
}
else
if
(
application
.
getProtocol
().
equalsIgnoreCase
(
ConstantsProtocols
.
BASIC
)){
modelAndView
=
WebContext
.
redirect
(
application
.
getLoginUrl
());
}
...
...
maxkey-protocols/maxkey-protocol-authorize/src/main/java/org/maxkey/authz/endpoint/adapter/AbstractAuthorizeAdapter.java
浏览文件 @
f3b799e7
...
...
@@ -2,7 +2,7 @@ package org.maxkey.authz.endpoint.adapter;
import
java.io.UnsupportedEncodingException
;
import
org.apache.commons.codec.binary.Hex
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.crypto.Base64Utils
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.crypto.cert.CertSigner
;
...
...
@@ -25,7 +25,7 @@ public abstract class AbstractAuthorizeAdapter {
public
abstract
String
generateInfo
(
UserInfo
userInfo
,
Object
app
);
public
String
sign
(
String
data
,
Apps
app
){
if
(
B
OOLEAN
.
isTrue
(
app
.
getIsSignature
())){
if
(
B
oolean
.
isTrue
(
app
.
getIsSignature
())){
KeyStoreLoader
keyStoreLoader
=(
KeyStoreLoader
)
WebContext
.
getBean
(
"keyStoreLoader"
);
try
{
byte
[]
signature
=
CertSigner
.
sign
(
data
.
getBytes
(),
keyStoreLoader
.
getKeyStore
(),
keyStoreLoader
.
getEntityName
(),
keyStoreLoader
.
getKeystorePassword
());
...
...
maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/Cas20AuthorizeEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -15,7 +15,7 @@ import org.maxkey.authz.cas.endpoint.ticket.service.TicketServices;
import
org.maxkey.authz.endpoint.AuthorizeBaseEndpoint
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.dao.service.AppsCasDetailsService
;
import
org.maxkey.dao.service.UserInfoService
;
import
org.maxkey.domain.UserInfo
;
...
...
@@ -194,7 +194,7 @@ For all error codes, it is RECOMMENDED that CAS provide a more detailed message
_logger
.
debug
(
"principal "
+
principal
);
serviceResponseBuilder
.
success
().
setUser
(
principal
);
if
(
B
OOLEAN
.
isTrue
(
storedTicket
.
getCasDetails
().
getIsAdapter
())){
if
(
B
oolean
.
isTrue
(
storedTicket
.
getCasDetails
().
getIsAdapter
())){
AbstractAuthorizeAdapter
adapter
=(
AbstractAuthorizeAdapter
)
Instance
.
newInstance
(
storedTicket
.
getCasDetails
().
getAdapter
());
UserInfo
userInfo
=
(
UserInfo
)
userInfoService
.
loadByUsername
(
principal
);
adapter
.
generateInfo
(
userInfo
,
serviceResponseBuilder
);
...
...
maxkey-protocols/maxkey-protocol-cas/src/main/java/org/maxkey/authz/cas/endpoint/Cas30AuthorizeEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -14,7 +14,7 @@ import org.maxkey.authz.cas.endpoint.ticket.service.TicketServices;
import
org.maxkey.authz.endpoint.AuthorizeBaseEndpoint
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.dao.service.AppsCasDetailsService
;
import
org.maxkey.dao.service.UserInfoService
;
import
org.maxkey.domain.UserInfo
;
...
...
@@ -74,7 +74,7 @@ public class Cas30AuthorizeEndpoint extends AuthorizeBaseEndpoint{
String
principal
=((
BasicAuthentication
)
storedTicket
.
getAuthentication
().
getPrincipal
()).
getUsername
();
serviceResponseBuilder
.
success
().
setUser
(
principal
);
if
(
B
OOLEAN
.
isTrue
(
storedTicket
.
getCasDetails
().
getIsAdapter
())){
if
(
B
oolean
.
isTrue
(
storedTicket
.
getCasDetails
().
getIsAdapter
())){
AbstractAuthorizeAdapter
adapter
=(
AbstractAuthorizeAdapter
)
Instance
.
newInstance
(
storedTicket
.
getCasDetails
().
getAdapter
());
UserInfo
userInfo
=
(
UserInfo
)
userInfoService
.
loadByUsername
(
principal
);
adapter
.
generateInfo
(
userInfo
,
serviceResponseBuilder
);
...
...
@@ -114,7 +114,7 @@ public class Cas30AuthorizeEndpoint extends AuthorizeBaseEndpoint{
String
principal
=((
BasicAuthentication
)
storedTicket
.
getAuthentication
().
getPrincipal
()).
getUsername
();
serviceResponseBuilder
.
success
().
setUser
(
principal
);
if
(
B
OOLEAN
.
isTrue
(
storedTicket
.
getCasDetails
().
getIsAdapter
())){
if
(
B
oolean
.
isTrue
(
storedTicket
.
getCasDetails
().
getIsAdapter
())){
AbstractAuthorizeAdapter
adapter
=(
AbstractAuthorizeAdapter
)
Instance
.
newInstance
(
storedTicket
.
getCasDetails
().
getAdapter
());
UserInfo
userInfo
=
(
UserInfo
)
userInfoService
.
loadByUsername
(
principal
);
adapter
.
generateInfo
(
userInfo
,
serviceResponseBuilder
);
...
...
maxkey-protocols/maxkey-protocol-desktop/src/main/java/org/maxkey/authz/desktop/endpoint/DesktopAuthorizeEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest;
import
org.maxkey.authz.desktop.endpoint.adapter.DesktopDefaultAdapter
;
import
org.maxkey.authz.endpoint.AuthorizeBaseEndpoint
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.dao.service.AppsDesktopDetailsService
;
import
org.maxkey.domain.Accounts
;
import
org.maxkey.domain.apps.AppsDesktopDetails
;
...
...
@@ -51,7 +51,7 @@ public class DesktopAuthorizeEndpoint extends AuthorizeBaseEndpoint{
ModelAndView
modelAndView
=
new
ModelAndView
();
AbstractAuthorizeAdapter
adapter
;
if
(
B
OOLEAN
.
isTrue
(
desktopDetails
.
getIsAdapter
())){
if
(
B
oolean
.
isTrue
(
desktopDetails
.
getIsAdapter
())){
adapter
=(
AbstractAuthorizeAdapter
)
Instance
.
newInstance
(
desktopDetails
.
getAdapter
());
}
else
{
adapter
=(
AbstractAuthorizeAdapter
)
defaultDesktopAdapter
;
...
...
maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/ExtendApiAuthorizeEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletRequest;
import
org.maxkey.authz.endpoint.AuthorizeBaseEndpoint
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.domain.Accounts
;
import
org.maxkey.domain.apps.Apps
;
import
org.maxkey.util.Instance
;
...
...
@@ -33,7 +33,7 @@ public class ExtendApiAuthorizeEndpoint extends AuthorizeBaseEndpoint{
Apps
apps
=
getApp
(
id
);
_logger
.
debug
(
""
+
apps
);
if
(
B
OOLEAN
.
isTrue
(
apps
.
getIsAdapter
())){
if
(
B
oolean
.
isTrue
(
apps
.
getIsAdapter
())){
Accounts
appUser
=
getAccounts
(
apps
);
if
(
appUser
==
null
){
...
...
maxkey-protocols/maxkey-protocol-formbased/src/main/java/org/maxkey/authz/formbased/endpoint/FormBasedAuthorizeEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest;
import
org.maxkey.authz.endpoint.AuthorizeBaseEndpoint
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.authz.formbased.endpoint.adapter.FormBasedDefaultAdapter
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.dao.service.AppsFormBasedDetailsService
;
import
org.maxkey.domain.Accounts
;
import
org.maxkey.domain.apps.Apps
;
...
...
@@ -60,7 +60,7 @@ public class FormBasedAuthorizeEndpoint extends AuthorizeBaseEndpoint{
AbstractAuthorizeAdapter
adapter
;
if
(
B
OOLEAN
.
isTrue
(
formBasedDetails
.
getIsAdapter
())){
if
(
B
oolean
.
isTrue
(
formBasedDetails
.
getIsAdapter
())){
adapter
=(
AbstractAuthorizeAdapter
)
Instance
.
newInstance
(
formBasedDetails
.
getAdapter
());
}
else
{
adapter
=(
AbstractAuthorizeAdapter
)
defaultFormBasedAdapter
;
...
...
maxkey-protocols/maxkey-protocol-formbased/src/main/java/org/maxkey/authz/formbased/endpoint/adapter/FormBasedDefaultAdapter.java
浏览文件 @
f3b799e7
package
org.maxkey.authz.formbased.endpoint.adapter
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.crypto.DigestUtils
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.domain.apps.AppsFormBasedDetails
;
...
...
@@ -28,7 +28,7 @@ public class FormBasedDefaultAdapter extends AbstractAuthorizeAdapter {
modelAndView
.
addObject
(
"username"
,
details
.
getAppUser
().
getRelatedUsername
());
modelAndView
.
addObject
(
"password"
,
details
.
getAppUser
().
getRelatedPassword
());
if
(
B
OOLEAN
.
isTrue
(
details
.
getIsExtendAttr
())){
if
(
B
oolean
.
isTrue
(
details
.
getIsExtendAttr
())){
modelAndView
.
addObject
(
"extendAttr"
,
details
.
getExtendAttr
());
modelAndView
.
addObject
(
"isExtendAttr"
,
true
);
}
else
{
...
...
maxkey-protocols/maxkey-protocol-formbased/src/main/java/org/maxkey/authz/formbased/endpoint/adapter/FormBasedNetease163EmailAdapter.java
浏览文件 @
f3b799e7
package
org.maxkey.authz.formbased.endpoint.adapter
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.domain.apps.AppsFormBasedDetails
;
import
org.springframework.web.servlet.ModelAndView
;
...
...
@@ -27,7 +27,7 @@ public class FormBasedNetease163EmailAdapter extends AbstractAuthorizeAdapter {
modelAndView
.
addObject
(
"email"
,
details
.
getAppUser
().
getRelatedUsername
());
modelAndView
.
addObject
(
"password"
,
details
.
getAppUser
().
getRelatedPassword
());
if
(
B
OOLEAN
.
isTrue
(
details
.
getIsExtendAttr
())){
if
(
B
oolean
.
isTrue
(
details
.
getIsExtendAttr
())){
modelAndView
.
addObject
(
"extendAttr"
,
details
.
getExtendAttr
());
modelAndView
.
addObject
(
"isExtendAttr"
,
true
);
}
else
{
...
...
maxkey-protocols/maxkey-protocol-formbased/src/main/java/org/maxkey/authz/formbased/endpoint/adapter/FormBasedRedirectAdapter.java
浏览文件 @
f3b799e7
package
org.maxkey.authz.formbased.endpoint.adapter
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.crypto.DigestUtils
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.domain.apps.AppsFormBasedDetails
;
...
...
@@ -61,7 +61,7 @@ public class FormBasedRedirectAdapter extends AbstractAuthorizeAdapter {
}
if
(
B
OOLEAN
.
isTrue
(
details
.
getIsExtendAttr
())){
if
(
B
oolean
.
isTrue
(
details
.
getIsExtendAttr
())){
modelAndView
.
addObject
(
"extendAttr"
,
details
.
getExtendAttr
());
modelAndView
.
addObject
(
"isExtendAttr"
,
true
);
}
else
{
...
...
maxkey-protocols/maxkey-protocol-oauth-2.0/src/main/java/org/maxkey/authz/oauth2/provider/userinfo/endpoint/UserInfoEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -11,7 +11,7 @@ import org.maxkey.authz.oauth2.common.exceptions.OAuth2Exception;
import
org.maxkey.authz.oauth2.provider.ClientDetailsService
;
import
org.maxkey.authz.oauth2.provider.OAuth2Authentication
;
import
org.maxkey.authz.oauth2.provider.token.DefaultTokenServices
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.crypto.jwt.encryption.service.JwtEncryptionAndDecryptionService
;
import
org.maxkey.crypto.jwt.encryption.service.impl.RecipientJwtEncryptionAndDecryptionServiceBuilder
;
...
...
@@ -106,7 +106,7 @@ public class UserInfoEndpoint {
String
userJson
=
""
;
AbstractAuthorizeAdapter
adapter
;
if
(
B
OOLEAN
.
isTrue
(
app
.
getIsAdapter
())){
if
(
B
oolean
.
isTrue
(
app
.
getIsAdapter
())){
adapter
=(
AbstractAuthorizeAdapter
)
Instance
.
newInstance
(
app
.
getAdapter
());
}
else
{
adapter
=(
AbstractAuthorizeAdapter
)
defaultOAuthUserInfoAdapter
;
...
...
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/consumer/endpoint/ConsumerEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -23,7 +23,7 @@ import org.maxkey.authz.saml20.consumer.spring.IdentityProviderAuthenticationExc
import
org.maxkey.authz.saml20.consumer.spring.ServiceProviderAuthenticationException
;
import
org.maxkey.authz.saml20.provider.xml.AuthnResponseGenerator
;
import
org.maxkey.authz.saml20.xml.SAML2ValidatorSuite
;
import
org.maxkey.constants.
LOGINTYPE
;
import
org.maxkey.constants.
ConstantsLoginType
;
import
org.maxkey.crypto.keystore.KeyStoreLoader
;
import
org.maxkey.dao.service.AppsSaml20DetailsService
;
import
org.maxkey.domain.apps.AppsSAML20Details
;
...
...
@@ -161,7 +161,7 @@ public class ConsumerEndpoint {
logger
.
debug
(
"assertion.getID() "
,
assertion
.
getAuthnStatements
());
WebContext
.
setAuthentication
(
username
,
LOGINTYPE
.
SAMLTRUST
,
""
,
""
,
"success"
);
WebContext
.
setAuthentication
(
username
,
ConstantsLoginType
.
SAMLTRUST
,
""
,
""
,
"success"
);
ModelAndView
mav
=
new
ModelAndView
();
mav
.
addObject
(
"username"
,
username
);
...
...
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/AttributeStatementGenerator.java
浏览文件 @
f3b799e7
...
...
@@ -7,7 +7,7 @@ import java.util.Iterator;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.domain.ExtraAttr
;
import
org.maxkey.domain.ExtraAttrs
;
import
org.maxkey.domain.apps.AppsSAML20Details
;
...
...
@@ -57,7 +57,7 @@ public class AttributeStatementGenerator {
}
logger
.
debug
(
"ExtendAttr "
+
saml20Details
.
getExtendAttr
());
if
(
B
OOLEAN
.
isTrue
(
saml20Details
.
getIsExtendAttr
()))
{
if
(
B
oolean
.
isTrue
(
saml20Details
.
getIsExtendAttr
()))
{
ExtraAttrs
extraAttrs
=
new
ExtraAttrs
(
saml20Details
.
getExtendAttr
());
for
(
ExtraAttr
extraAttr
:
extraAttrs
.
getExtraAttrs
())
{
logger
.
debug
(
"Attribute : "
+
extraAttr
.
getAttr
()+
" , Vale : "
+
extraAttr
.
getValue
()+
" , Type : "
+
extraAttr
.
getType
());
...
...
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/AuthnResponseGenerator.java
浏览文件 @
f3b799e7
...
...
@@ -8,7 +8,7 @@ import org.maxkey.authz.saml.service.IDService;
import
org.maxkey.authz.saml.service.TimeService
;
import
org.maxkey.authz.saml20.binding.BindingAdapter
;
import
org.maxkey.authz.saml20.xml.IssuerGenerator
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.domain.apps.AppsSAML20Details
;
import
org.opensaml.Configuration
;
import
org.opensaml.saml2.core.Assertion
;
...
...
@@ -61,7 +61,7 @@ public class AuthnResponseGenerator {
attributeMap
);
//Encrypt
if
(
B
OOLEAN
.
isTrue
(
saml20Details
.
getEncrypted
()))
{
if
(
B
oolean
.
isTrue
(
saml20Details
.
getEncrypted
()))
{
logger
.
info
(
"begin to encrypt assertion"
);
try
{
// Assume this contains a recipient's RSA public
...
...
maxkey-protocols/maxkey-protocol-tokenbased/src/main/java/org/maxkey/authz/token/endpoint/TokenBasedAuthorizeEndpoint.java
浏览文件 @
f3b799e7
...
...
@@ -11,7 +11,7 @@ import org.maxkey.authz.endpoint.AuthorizeBaseEndpoint;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.authz.token.endpoint.adapter.TokenBasedDefaultAdapter
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.dao.service.AppsTokenBasedDetailsService
;
import
org.maxkey.domain.apps.Apps
;
import
org.maxkey.domain.apps.AppsTokenBasedDetails
;
...
...
@@ -58,7 +58,7 @@ public class TokenBasedAuthorizeEndpoint extends AuthorizeBaseEndpoint{
tokenBasedDetails
.
setIsAdapter
(
application
.
getIsAdapter
());
AbstractAuthorizeAdapter
adapter
;
if
(
B
OOLEAN
.
isTrue
(
tokenBasedDetails
.
getIsAdapter
())){
if
(
B
oolean
.
isTrue
(
tokenBasedDetails
.
getIsAdapter
())){
adapter
=(
AbstractAuthorizeAdapter
)
Instance
.
newInstance
(
tokenBasedDetails
.
getAdapter
());
}
else
{
adapter
=(
AbstractAuthorizeAdapter
)
defaultTokenBasedAdapter
;
...
...
maxkey-protocols/maxkey-protocol-tokenbased/src/main/java/org/maxkey/authz/token/endpoint/adapter/TokenBasedDefaultAdapter.java
浏览文件 @
f3b799e7
...
...
@@ -4,7 +4,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.domain.apps.AppsTokenBasedDetails
;
import
org.maxkey.util.DateUtils
;
...
...
@@ -23,25 +23,25 @@ public class TokenBasedDefaultAdapter extends AbstractAuthorizeAdapter {
beanMap
.
put
(
"randomId"
,(
new
StringGenerator
()).
uuidGenerate
());
if
(
B
OOLEAN
.
isTrue
(
details
.
getUid
())){
if
(
B
oolean
.
isTrue
(
details
.
getUid
())){
beanMap
.
put
(
"uid"
,
userInfo
.
getId
());
}
if
(
B
OOLEAN
.
isTrue
(
details
.
getUsername
())){
if
(
B
oolean
.
isTrue
(
details
.
getUsername
())){
beanMap
.
put
(
"username"
,
userInfo
.
getUsername
());
}
if
(
B
OOLEAN
.
isTrue
(
details
.
getEmail
())){
if
(
B
oolean
.
isTrue
(
details
.
getEmail
())){
beanMap
.
put
(
"email"
,
userInfo
.
getEmail
());
}
if
(
B
OOLEAN
.
isTrue
(
details
.
getWindowsAccount
())){
if
(
B
oolean
.
isTrue
(
details
.
getWindowsAccount
())){
beanMap
.
put
(
"windowsAccount"
,
userInfo
.
getWindowsAccount
());
}
if
(
B
OOLEAN
.
isTrue
(
details
.
getEmployeeNumber
())){
if
(
B
oolean
.
isTrue
(
details
.
getEmployeeNumber
())){
beanMap
.
put
(
"employeeNumber"
,
userInfo
.
getEmployeeNumber
());
}
if
(
B
OOLEAN
.
isTrue
(
details
.
getDepartmentId
())){
if
(
B
oolean
.
isTrue
(
details
.
getDepartmentId
())){
beanMap
.
put
(
"departmentId"
,
userInfo
.
getDepartmentId
());
}
if
(
B
OOLEAN
.
isTrue
(
details
.
getDepartment
())){
if
(
B
oolean
.
isTrue
(
details
.
getDepartment
())){
beanMap
.
put
(
"department"
,
userInfo
.
getDepartment
());
}
...
...
maxkey-protocols/maxkey-protocol-tokenbased/src/main/java/org/maxkey/authz/token/endpoint/adapter/TokenBasedSimpleAdapter.java
浏览文件 @
f3b799e7
...
...
@@ -3,7 +3,7 @@ package org.maxkey.authz.token.endpoint.adapter;
import
java.util.Date
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.constants.B
OOLEAN
;
import
org.maxkey.constants.B
oolean
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.domain.apps.AppsTokenBasedDetails
;
import
org.maxkey.util.DateUtils
;
...
...
@@ -19,17 +19,17 @@ public class TokenBasedSimpleAdapter extends AbstractAuthorizeAdapter {
String
tokenUsername
=
""
;
if
(
B
OOLEAN
.
isTrue
(
details
.
getUid
())){
if
(
B
oolean
.
isTrue
(
details
.
getUid
())){
tokenUsername
=
userInfo
.
getId
();
}
else
if
(
B
OOLEAN
.
isTrue
(
details
.
getUsername
())){
}
else
if
(
B
oolean
.
isTrue
(
details
.
getUsername
())){
tokenUsername
=
userInfo
.
getUsername
();
}
else
if
(
B
OOLEAN
.
isTrue
(
details
.
getEmail
())){
}
else
if
(
B
oolean
.
isTrue
(
details
.
getEmail
())){
tokenUsername
=
userInfo
.
getEmail
();
}
else
if
(
B
OOLEAN
.
isTrue
(
details
.
getWindowsAccount
())){
}
else
if
(
B
oolean
.
isTrue
(
details
.
getWindowsAccount
())){
tokenUsername
=
userInfo
.
getWindowsAccount
();
}
else
if
(
B
OOLEAN
.
isTrue
(
details
.
getEmployeeNumber
())){
}
else
if
(
B
oolean
.
isTrue
(
details
.
getEmployeeNumber
())){
tokenUsername
=
userInfo
.
getEmployeeNumber
();
}
else
if
(
B
OOLEAN
.
isTrue
(
details
.
getDepartmentId
())){
}
else
if
(
B
oolean
.
isTrue
(
details
.
getDepartmentId
())){
tokenUsername
=
userInfo
.
getDepartmentId
();
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/ApplicationsController.java
浏览文件 @
f3b799e7
...
...
@@ -2,7 +2,7 @@ package org.maxkey.web.apps.contorller;
import
org.apache.mybatis.jpa.persistence.JpaPageResults
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.domain.ExtraAttr
;
import
org.maxkey.domain.ExtraAttrs
;
...
...
@@ -62,10 +62,10 @@ public class ApplicationsController extends BaseAppContorller {
transform
(
application
);
if
(
appsService
.
insert
(
application
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
}
...
...
@@ -92,10 +92,10 @@ public class ApplicationsController extends BaseAppContorller {
}
if
(
appsService
.
updateExtendAttr
(
application
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -109,10 +109,10 @@ public class ApplicationsController extends BaseAppContorller {
public
Message
query
(
@ModelAttribute
(
"application"
)
Apps
application
)
{
_logger
.
debug
(
"-query :"
+
application
);
if
(
appsService
.
load
(
application
)!=
null
)
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -127,10 +127,10 @@ public class ApplicationsController extends BaseAppContorller {
public
Message
update
(
@ModelAttribute
(
"application"
)
Apps
application
)
{
_logger
.
debug
(
"-update application :"
+
application
);
if
(
appsService
.
update
(
application
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -141,10 +141,10 @@ public class ApplicationsController extends BaseAppContorller {
public
Message
delete
(
@ModelAttribute
(
"application"
)
Apps
application
)
{
_logger
.
debug
(
"-delete application :"
+
application
);
if
(
appsService
.
delete
(
application
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/BaseAppContorller.java
浏览文件 @
f3b799e7
...
...
@@ -5,7 +5,7 @@ package org.maxkey.web.apps.contorller;
import
java.io.IOException
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.dao.service.AppsService
;
...
...
@@ -65,7 +65,7 @@ public class BaseAppContorller {
protected
void
encodeSharedPassword
(
Apps
application
){
if
(
application
.
getCredential
()!=
Apps
.
CREDENTIALS
.
SHARED
){
if
(
application
.
getProtocol
().
equals
(
PROTOCOLS
.
DESKTOP
)||
application
.
getProtocol
().
equals
(
PROTOCOLS
.
FORMBASED
)){
if
(
application
.
getProtocol
().
equals
(
ConstantsProtocols
.
DESKTOP
)||
application
.
getProtocol
().
equals
(
ConstantsProtocols
.
FORMBASED
)){
if
(
StringUtils
.
isNotEmpty
(
application
.
getSharedPassword
())){
application
.
setSharedPassword
(
ReciprocalUtils
.
encode
(
application
.
getSharedPassword
()));
}
...
...
@@ -75,7 +75,7 @@ public class BaseAppContorller {
protected
void
decoderSharedPassword
(
Apps
application
){
if
(
application
.
getCredential
()!=
Apps
.
CREDENTIALS
.
SHARED
){
if
(
application
.
getProtocol
().
equals
(
PROTOCOLS
.
DESKTOP
)||
application
.
getProtocol
().
equals
(
PROTOCOLS
.
FORMBASED
)){
if
(
application
.
getProtocol
().
equals
(
ConstantsProtocols
.
DESKTOP
)||
application
.
getProtocol
().
equals
(
ConstantsProtocols
.
FORMBASED
)){
if
(
StringUtils
.
isNotEmpty
(
application
.
getSharedPassword
())){
application
.
setSharedPassword
(
ReciprocalUtils
.
decoder
(
application
.
getSharedPassword
()));
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/BasicDetailsController.java
浏览文件 @
f3b799e7
...
...
@@ -2,8 +2,8 @@ package org.maxkey.web.apps.contorller;
import
java.util.List
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.domain.apps.Apps
;
import
org.maxkey.web.WebContext
;
...
...
@@ -30,7 +30,7 @@ public class BasicDetailsController extends BaseAppContorller {
ModelAndView
modelAndView
=
new
ModelAndView
(
"apps/basic/appAdd"
);
Apps
appDetails
=
new
Apps
();
appDetails
.
setId
(
appDetails
.
generateId
());
appDetails
.
setProtocol
(
PROTOCOLS
.
BASIC
);
appDetails
.
setProtocol
(
ConstantsProtocols
.
BASIC
);
appDetails
.
setSecret
(
ReciprocalUtils
.
generateKey
(
ReciprocalUtils
.
Algorithm
.
DES
));
modelAndView
.
addObject
(
"model"
,
appDetails
);
return
modelAndView
;
...
...
@@ -44,10 +44,10 @@ public class BasicDetailsController extends BaseAppContorller {
transform
(
appDetails
);
if
(
appsService
.
insert
(
appDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
appDetails
.
getId
());
}
...
...
@@ -74,10 +74,10 @@ public class BasicDetailsController extends BaseAppContorller {
transform
(
appDetails
);
if
(
appsService
.
update
(
appDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
appDetails
.
getId
());
}
...
...
@@ -88,10 +88,10 @@ public class BasicDetailsController extends BaseAppContorller {
public
Message
delete
(
@PathVariable
(
"id"
)
String
id
)
{
_logger
.
debug
(
"-delete application :"
+
id
);
if
(
appsService
.
remove
(
id
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/CasDetailsController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.apps.contorller
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.dao.service.AppsCasDetailsService
;
import
org.maxkey.domain.apps.AppsCasDetails
;
...
...
@@ -32,7 +32,7 @@ public class CasDetailsController extends BaseAppContorller {
ModelAndView
modelAndView
=
new
ModelAndView
(
"apps/cas/appAdd"
);
AppsCasDetails
casDetails
=
new
AppsCasDetails
();
casDetails
.
setId
(
casDetails
.
generateId
());
casDetails
.
setProtocol
(
PROTOCOLS
.
CAS
);
casDetails
.
setProtocol
(
ConstantsProtocols
.
CAS
);
casDetails
.
setSecret
(
ReciprocalUtils
.
generateKey
(
ReciprocalUtils
.
Algorithm
.
DES
));
modelAndView
.
addObject
(
"model"
,
casDetails
);
return
modelAndView
;
...
...
@@ -46,10 +46,10 @@ public class CasDetailsController extends BaseAppContorller {
transform
(
casDetails
);
if
(
casDetailsService
.
insert
(
casDetails
)&&
appsService
.
insertApp
(
casDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
casDetails
.
getId
());
}
...
...
@@ -77,10 +77,10 @@ public class CasDetailsController extends BaseAppContorller {
transform
(
casDetails
);
if
(
casDetailsService
.
update
(
casDetails
)&&
appsService
.
updateApp
(
casDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
casDetails
.
getId
());
}
...
...
@@ -91,10 +91,10 @@ public class CasDetailsController extends BaseAppContorller {
public
Message
delete
(
@PathVariable
(
"id"
)
String
id
)
{
_logger
.
debug
(
"-delete application :"
+
id
);
if
(
casDetailsService
.
remove
(
id
)&&
appsService
.
remove
(
id
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/DesktopDetailsController.java
浏览文件 @
f3b799e7
...
...
@@ -2,8 +2,8 @@ package org.maxkey.web.apps.contorller;
import
java.util.List
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.dao.service.AppsDesktopDetailsService
;
import
org.maxkey.domain.apps.AppsDesktopDetails
;
...
...
@@ -34,7 +34,7 @@ public class DesktopDetailsController extends BaseAppContorller {
ModelAndView
modelAndView
=
new
ModelAndView
(
"apps/desktop/appAdd"
);
AppsDesktopDetails
desktopDetails
=
new
AppsDesktopDetails
();
desktopDetails
.
setId
(
desktopDetails
.
generateId
());
desktopDetails
.
setProtocol
(
PROTOCOLS
.
DESKTOP
);
desktopDetails
.
setProtocol
(
ConstantsProtocols
.
DESKTOP
);
desktopDetails
.
setSecret
(
ReciprocalUtils
.
generateKey
(
""
));
modelAndView
.
addObject
(
"model"
,
desktopDetails
);
...
...
@@ -50,10 +50,10 @@ public class DesktopDetailsController extends BaseAppContorller {
transform
(
desktopDetails
);
desktopDetailsService
.
insert
(
desktopDetails
);
if
(
appsService
.
insertApp
(
desktopDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
desktopDetails
.
getId
());
}
...
...
@@ -82,10 +82,10 @@ public class DesktopDetailsController extends BaseAppContorller {
transform
(
desktopDetails
);
if
(
desktopDetailsService
.
update
(
desktopDetails
)&&
appsService
.
updateApp
(
desktopDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
desktopDetails
.
getId
());
}
...
...
@@ -95,10 +95,10 @@ public class DesktopDetailsController extends BaseAppContorller {
public
Message
delete
(
@PathVariable
(
"id"
)
String
id
)
{
_logger
.
debug
(
"-delete application :"
+
id
);
if
(
desktopDetailsService
.
remove
(
id
)&&
appsService
.
remove
(
id
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/ExtendApiDetailsController.java
浏览文件 @
f3b799e7
...
...
@@ -2,8 +2,8 @@ package org.maxkey.web.apps.contorller;
import
java.util.List
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.domain.apps.Apps
;
import
org.maxkey.domain.apps.AppsExtendApiDetails
;
...
...
@@ -32,7 +32,7 @@ public class ExtendApiDetailsController extends BaseAppContorller {
ModelAndView
modelAndView
=
new
ModelAndView
(
"apps/extendapi/appAdd"
);
AppsExtendApiDetails
extendApiDetails
=
new
AppsExtendApiDetails
();
extendApiDetails
.
setId
(
extendApiDetails
.
generateId
());
extendApiDetails
.
setProtocol
(
PROTOCOLS
.
EXTEND_API
);
extendApiDetails
.
setProtocol
(
ConstantsProtocols
.
EXTEND_API
);
extendApiDetails
.
setSecret
(
ReciprocalUtils
.
generateKey
(
""
));
modelAndView
.
addObject
(
"model"
,
extendApiDetails
);
...
...
@@ -46,10 +46,10 @@ public class ExtendApiDetailsController extends BaseAppContorller {
transform
(
extendApiDetails
);
if
(
appsService
.
insert
(
extendApiDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
extendApiDetails
.
getId
());
}
...
...
@@ -79,10 +79,10 @@ public class ExtendApiDetailsController extends BaseAppContorller {
transform
(
extendApiDetails
);
if
(
appsService
.
update
(
extendApiDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
extendApiDetails
.
getId
());
}
...
...
@@ -93,10 +93,10 @@ public class ExtendApiDetailsController extends BaseAppContorller {
public
Message
delete
(
@PathVariable
(
"id"
)
String
id
)
{
_logger
.
debug
(
"-delete application :"
+
id
);
if
(
appsService
.
remove
(
id
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/FormBasedDetailsController.java
浏览文件 @
f3b799e7
...
...
@@ -2,8 +2,8 @@ package org.maxkey.web.apps.contorller;
import
java.util.List
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.dao.service.AppsFormBasedDetailsService
;
import
org.maxkey.domain.apps.AppsFormBasedDetails
;
...
...
@@ -35,7 +35,7 @@ public class FormBasedDetailsController extends BaseAppContorller {
ModelAndView
modelAndView
=
new
ModelAndView
(
"apps/formbased/appAdd"
);
AppsFormBasedDetails
formBasedDetails
=
new
AppsFormBasedDetails
();
formBasedDetails
.
setId
(
formBasedDetails
.
generateId
());
formBasedDetails
.
setProtocol
(
PROTOCOLS
.
FORMBASED
);
formBasedDetails
.
setProtocol
(
ConstantsProtocols
.
FORMBASED
);
formBasedDetails
.
setSecret
(
ReciprocalUtils
.
generateKey
(
""
));
modelAndView
.
addObject
(
"model"
,
formBasedDetails
);
...
...
@@ -51,10 +51,10 @@ public class FormBasedDetailsController extends BaseAppContorller {
transform
(
formBasedDetails
);
if
(
formBasedDetailsService
.
insert
(
formBasedDetails
)&&
appsService
.
insertApp
(
formBasedDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
formBasedDetails
.
getId
());
}
...
...
@@ -81,10 +81,10 @@ public class FormBasedDetailsController extends BaseAppContorller {
_logger
.
debug
(
"-update application :"
+
formBasedDetails
);
transform
(
formBasedDetails
);
if
(
formBasedDetailsService
.
update
(
formBasedDetails
)&&
appsService
.
updateApp
(
formBasedDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
formBasedDetails
.
getId
());
}
...
...
@@ -95,10 +95,10 @@ public class FormBasedDetailsController extends BaseAppContorller {
public
Message
delete
(
@PathVariable
(
"id"
)
String
id
)
{
_logger
.
debug
(
"-delete application :"
+
id
);
if
(
formBasedDetailsService
.
remove
(
id
)&&
appsService
.
remove
(
id
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_ERROR
),
MessageType
.
error
);
}
}
}
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/OAuth20DetailsController.java
浏览文件 @
f3b799e7
...
...
@@ -3,8 +3,8 @@ package org.maxkey.web.apps.contorller;
import
java.util.List
;
import
org.maxkey.authz.oauth2.provider.client.JdbcClientDetailsService
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.domain.apps.Apps
;
import
org.maxkey.domain.apps.AppsOAuth20Details
;
...
...
@@ -40,7 +40,7 @@ public class OAuth20DetailsController extends BaseAppContorller {
oauth20Details
.
setSecret
(
ReciprocalUtils
.
generateKey
(
""
));
oauth20Details
.
setClientId
(
oauth20Details
.
getId
());
oauth20Details
.
setClientSecret
(
oauth20Details
.
getSecret
());
oauth20Details
.
setProtocol
(
PROTOCOLS
.
OAUTH20
);
oauth20Details
.
setProtocol
(
ConstantsProtocols
.
OAUTH20
);
modelAndView
.
addObject
(
"model"
,
oauth20Details
);
return
modelAndView
;
}
...
...
@@ -56,10 +56,10 @@ public class OAuth20DetailsController extends BaseAppContorller {
oauth20JdbcClientDetailsService
.
addClientDetails
(
oauth20Details
.
clientDetailsRowMapper
());
if
(
appsService
.
insertApp
(
oauth20Details
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
oauth20Details
.
getId
());
}
...
...
@@ -94,9 +94,9 @@ public class OAuth20DetailsController extends BaseAppContorller {
oauth20JdbcClientDetailsService
.
updateClientDetails
(
oauth20Details
.
clientDetailsRowMapper
());
oauth20JdbcClientDetailsService
.
updateClientSecret
(
oauth20Details
.
getClientId
(),
oauth20Details
.
getClientSecret
());
if
(
appsService
.
updateApp
(
oauth20Details
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
oauth20Details
.
getId
());
}
...
...
@@ -108,10 +108,10 @@ public class OAuth20DetailsController extends BaseAppContorller {
_logger
.
debug
(
"-delete application :"
+
id
);
oauth20JdbcClientDetailsService
.
removeClientDetails
(
id
);
if
(
appsService
.
remove
(
id
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/SAML20DetailsController.java
浏览文件 @
f3b799e7
...
...
@@ -7,8 +7,8 @@ import java.security.cert.X509Certificate;
import
java.util.List
;
import
org.maxkey.authz.saml20.metadata.MetadataDescriptorUtil
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.crypto.cert.NameUtil
;
import
org.maxkey.crypto.cert.X509CertUtils
;
...
...
@@ -54,7 +54,7 @@ public class SAML20DetailsController extends BaseAppContorller {
ModelAndView
modelAndView
=
new
ModelAndView
(
"apps/saml20/appAdd"
);
AppsSAML20Details
saml20Details
=
new
AppsSAML20Details
();
saml20Details
.
setSecret
(
ReciprocalUtils
.
generateKey
(
""
));
saml20Details
.
setProtocol
(
PROTOCOLS
.
SAML20
);
saml20Details
.
setProtocol
(
ConstantsProtocols
.
SAML20
);
modelAndView
.
addObject
(
"model"
,
saml20Details
);
return
modelAndView
;
...
...
@@ -72,10 +72,10 @@ public class SAML20DetailsController extends BaseAppContorller {
}
saml20DetailsService
.
insert
(
saml20Details
);
if
(
appsService
.
insertApp
(
saml20Details
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
saml20Details
.
getId
());
}
...
...
@@ -107,10 +107,10 @@ public class SAML20DetailsController extends BaseAppContorller {
}
saml20DetailsService
.
update
(
saml20Details
);
if
(
appsService
.
updateApp
(
saml20Details
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
saml20Details
.
getId
());
}
...
...
@@ -121,10 +121,10 @@ public class SAML20DetailsController extends BaseAppContorller {
public
Message
delete
(
@PathVariable
(
"id"
)
String
id
)
{
_logger
.
debug
(
"-delete application :"
+
id
);
if
(
saml20DetailsService
.
remove
(
id
)&&
appsService
.
remove
(
id
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/apps/contorller/TokenBasedDetailsController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.apps.contorller
;
import
java.util.List
;
import
org.maxkey.constants.OPERATEMESSAGE
;
import
org.maxkey.constants.PROTOCOLS
;
import
org.maxkey.constants.ConstantsOperateMessage
;
import
org.maxkey.constants.ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.dao.service.AppsTokenBasedDetailsService
;
import
org.maxkey.domain.apps.AppsTokenBasedDetails
;
...
...
@@ -34,7 +32,7 @@ public class TokenBasedDetailsController extends BaseAppContorller {
public
ModelAndView
forwardAdd
()
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"apps/tokenbased/appAdd"
);
AppsTokenBasedDetails
tokenBasedDetails
=
new
AppsTokenBasedDetails
();
tokenBasedDetails
.
setProtocol
(
PROTOCOLS
.
TOKENBASED
);
tokenBasedDetails
.
setProtocol
(
ConstantsProtocols
.
TOKENBASED
);
tokenBasedDetails
.
setSecret
(
ReciprocalUtils
.
generateKey
(
ReciprocalUtils
.
Algorithm
.
AES
));
tokenBasedDetails
.
setAlgorithmKey
(
tokenBasedDetails
.
getSecret
());
modelAndView
.
addObject
(
"model"
,
tokenBasedDetails
);
...
...
@@ -51,10 +49,10 @@ public class TokenBasedDetailsController extends BaseAppContorller {
tokenBasedDetails
.
setAlgorithmKey
(
tokenBasedDetails
.
getSecret
());
if
(
tokenBasedDetailsService
.
insert
(
tokenBasedDetails
)&&
appsService
.
insertApp
(
tokenBasedDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
tokenBasedDetails
.
getId
());
}
...
...
@@ -83,10 +81,10 @@ public class TokenBasedDetailsController extends BaseAppContorller {
transform
(
tokenBasedDetails
);
tokenBasedDetails
.
setAlgorithmKey
(
tokenBasedDetails
.
getSecret
());
if
(
tokenBasedDetailsService
.
update
(
tokenBasedDetails
)&&
appsService
.
updateApp
(
tokenBasedDetails
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardUpdate/"
+
tokenBasedDetails
.
getId
());
}
...
...
@@ -97,10 +95,10 @@ public class TokenBasedDetailsController extends BaseAppContorller {
public
Message
delete
(
@PathVariable
(
"id"
)
String
id
)
{
_logger
.
debug
(
"-delete application :"
+
id
);
if
(
tokenBasedDetailsService
.
remove
(
id
)&&
appsService
.
remove
(
id
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/AccountsController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.contorller
;
import
org.apache.mybatis.jpa.persistence.JpaPageResults
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.dao.service.AccountsService
;
import
org.maxkey.dao.service.AppsService
;
...
...
@@ -79,7 +79,7 @@ public class AccountsController {
_logger
.
debug
(
"-update :"
+
appAccounts
);
appAccounts
.
setRelatedPassword
(
ReciprocalUtils
.
encode
(
appAccounts
.
getRelatedPassword
()));
accountsService
.
insert
(
appAccounts
);
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
...
...
@@ -107,7 +107,7 @@ public class AccountsController {
appAccounts
.
setRelatedPassword
(
ReciprocalUtils
.
encode
(
appAccounts
.
getRelatedPassword
()));
accountsService
.
update
(
appAccounts
);
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
...
...
@@ -123,7 +123,7 @@ public class AccountsController {
accountsService
.
remove
(
appAccountsds
[
i
]);
}
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/GroupMemberController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.contorller
;
import
org.apache.mybatis.jpa.persistence.JpaPageResults
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.dao.service.GroupMemberService
;
import
org.maxkey.dao.service.GroupsService
;
import
org.maxkey.domain.GroupMember
;
...
...
@@ -115,11 +115,11 @@ public class GroupMemberController {
result
=
groupMemberService
.
insert
(
newGroupMember
);
}
if
(!
result
)
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
info
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
info
);
}
@RequestMapping
(
value
=
{
"/delete"
})
...
...
@@ -138,10 +138,10 @@ public class GroupMemberController {
groupMemberService
.
remove
(
arrMemberIds
[
i
]);
}
if
(!
result
)
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
info
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
info
);
}
}
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/GroupPrivilegesController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.contorller
;
import
org.apache.mybatis.jpa.persistence.JpaPageResults
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.dao.service.GroupPrivilegesService
;
import
org.maxkey.domain.GroupPrivileges
;
import
org.maxkey.domain.apps.Apps
;
...
...
@@ -97,11 +97,11 @@ public class GroupPrivilegesController {
result
=
groupPrivilegesService
.
insert
(
newGroupApp
);
}
if
(!
result
)
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
info
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
info
);
}
@RequestMapping
(
value
=
{
"/delete"
})
...
...
@@ -121,11 +121,11 @@ public class GroupPrivilegesController {
result
=
groupPrivilegesService
.
remove
(
arrPrivilegesIds
[
i
]);
}
if
(!
result
)
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
info
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
info
);
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/GroupsController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.contorller
;
import
org.apache.mybatis.jpa.persistence.JpaPageResults
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.dao.service.GroupsService
;
import
org.maxkey.domain.Groups
;
import
org.maxkey.web.WebContext
;
...
...
@@ -68,10 +68,10 @@ public class GroupsController {
_logger
.
debug
(
"-Add :"
+
group
);
if
(
groupsService
.
insert
(
group
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
}
...
...
@@ -86,10 +86,10 @@ public class GroupsController {
public
Message
query
(
@ModelAttribute
(
"group"
)
Groups
group
)
{
_logger
.
debug
(
"-query :"
+
group
);
if
(
groupsService
.
load
(
group
)!=
null
)
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -105,10 +105,10 @@ public class GroupsController {
_logger
.
debug
(
"-update group :"
+
group
);
if
(
groupsService
.
update
(
group
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -120,10 +120,10 @@ public class GroupsController {
_logger
.
debug
(
"-delete group :"
+
group
);
if
(
groupsService
.
remove
(
group
.
getId
()))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/IpAddrFilterController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.contorller
;
import
org.apache.mybatis.jpa.persistence.JpaPageResults
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.dao.service.IpAddrFilterService
;
import
org.maxkey.domain.IpAddrFilter
;
import
org.maxkey.web.WebContext
;
...
...
@@ -63,10 +63,10 @@ public class IpAddrFilterController {
_logger
.
debug
(
"-Add :"
+
ipAddrFilter
);
if
(
ipAddrFilterService
.
insert
(
ipAddrFilter
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
error
);
}
}
...
...
@@ -81,10 +81,10 @@ public class IpAddrFilterController {
public
Message
query
(
@ModelAttribute
(
"ipAddrFilter"
)
IpAddrFilter
ipAddrFilter
)
{
_logger
.
debug
(
"-query :"
+
ipAddrFilter
);
if
(
ipAddrFilterService
.
load
(
ipAddrFilter
)!=
null
)
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -100,10 +100,10 @@ public class IpAddrFilterController {
_logger
.
debug
(
"-update ipAddrFilter :"
+
ipAddrFilter
);
if
(
ipAddrFilterService
.
update
(
ipAddrFilter
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -115,10 +115,10 @@ public class IpAddrFilterController {
_logger
.
debug
(
"-delete ipAddrFilter :"
+
ipAddrFilter
);
if
(
ipAddrFilterService
.
delete
(
ipAddrFilter
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/PasswordPolicyController.java
浏览文件 @
f3b799e7
...
...
@@ -2,7 +2,7 @@ package org.maxkey.web.contorller;
import
javax.validation.Valid
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.dao.service.PasswordPolicyService
;
import
org.maxkey.domain.PasswordPolicy
;
import
org.maxkey.web.WebContext
;
...
...
@@ -53,9 +53,9 @@ public class PasswordPolicyController {
return
message
;
}
if
(
passwordPolicyService
.
update
(
passwordPolicy
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
...
...
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/UserInfoController.java
浏览文件 @
f3b799e7
...
...
@@ -9,7 +9,7 @@ import java.util.Map;
import
javax.validation.Valid
;
import
org.apache.mybatis.jpa.persistence.JpaPageResults
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.dao.service.UserInfoService
;
import
org.maxkey.domain.UserInfo
;
...
...
@@ -108,10 +108,10 @@ public class UserInfoController {
//userInfo.setNameZHShortSpell(StringUtils.hanYu2Pinyin(userInfo.getDisplayName(), true));
//userInfo.setNameZHSpell(StringUtils.hanYu2Pinyin(userInfo.getDisplayName(), false));
if
(
userInfoService
.
insert
(
userInfo
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_SUCCESS
),
userInfo
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
userInfo
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
}
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
INSERT_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
return
WebContext
.
forward
(
"forwardUpdate/"
+
userInfo
.
getId
());
}
...
...
@@ -167,10 +167,10 @@ public class UserInfoController {
convertExtraAttribute
(
userInfo
)
;
_logger
.
info
(
userInfo
.
getExtraAttribute
());
if
(
userInfoService
.
update
(
userInfo
))
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
userInfo
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
userInfo
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
}
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
return
WebContext
.
forward
(
"forwardUpdate/"
+
userInfo
.
getId
());
}
...
...
@@ -185,10 +185,10 @@ public class UserInfoController {
public
Message
batchDeleteUsers
(
@RequestParam
(
"id"
)
String
id
)
{
_logger
.
debug
(
id
);
if
(
userInfoService
.
batchDelete
(
StringUtils
.
string2List
(
id
,
","
)))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -204,9 +204,9 @@ public class UserInfoController {
_logger
.
debug
(
id
);
if
(
userInfoService
.
batchDelete
(
StringUtils
.
string2List
(
id
,
","
)))
{
//provisioningPrepare.prepare(userInfo, OPERATEACTION.DELETE_ACTION);
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
DELETE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -237,10 +237,10 @@ public class UserInfoController {
public
Message
changePassword
(
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
)
{
_logger
.
debug
(
userInfo
.
getId
());
if
(
userInfoService
.
changePassword
(
userInfo
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/AppListController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.contorller
;
import
java.util.List
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
PROTOCOLS
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.constants.
ConstantsProtocols
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.dao.service.AccountsService
;
import
org.maxkey.dao.service.AppsService
;
...
...
@@ -171,10 +171,10 @@ public class AppListController {
userInfoService
.
updateProtectedApps
(
userInfo
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
@RequestMapping
(
value
=
{
"/forward/appUserConfig/{protocol}/{credential}/{appId}"
})
...
...
@@ -187,12 +187,12 @@ public class AppListController {
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
if
(
credential
==
Apps
.
CREDENTIALS
.
USER_DEFINED
)
{
appUsers
=
appUsersService
.
load
(
new
Accounts
(
userInfo
.
getId
(),
appId
));
if
(
protocol
.
equalsIgnoreCase
(
PROTOCOLS
.
DESKTOP
)
||
protocol
.
equalsIgnoreCase
(
PROTOCOLS
.
FORMBASED
)
||
protocol
.
equalsIgnoreCase
(
PROTOCOLS
.
BASIC
)
||
protocol
.
equalsIgnoreCase
(
PROTOCOLS
.
EXTEND_API
))
{
if
(
protocol
.
equalsIgnoreCase
(
ConstantsProtocols
.
DESKTOP
)
||
protocol
.
equalsIgnoreCase
(
ConstantsProtocols
.
FORMBASED
)
||
protocol
.
equalsIgnoreCase
(
ConstantsProtocols
.
BASIC
)
||
protocol
.
equalsIgnoreCase
(
ConstantsProtocols
.
EXTEND_API
))
{
modelAndView
.
addObject
(
"username"
,
true
);
modelAndView
.
addObject
(
"password"
,
true
);
}
else
if
(
protocol
.
equalsIgnoreCase
(
PROTOCOLS
.
SAML20
))
{
}
else
if
(
protocol
.
equalsIgnoreCase
(
ConstantsProtocols
.
SAML20
))
{
modelAndView
.
addObject
(
"username"
,
true
);
modelAndView
.
addObject
(
"password"
,
false
);
}
else
{
...
...
@@ -253,6 +253,6 @@ public class AppListController {
}
}
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
}
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/ProfileController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.contorller
;
import
javax.validation.Valid
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.dao.service.MyProfileService
;
import
org.maxkey.dao.service.UserInfoService
;
import
org.maxkey.domain.UserInfo
;
...
...
@@ -71,12 +71,12 @@ public class ProfileController {
if
(
myProfileService
.
updateProfile
(
userInfo
)
>
0
)
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
userInfo
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
}
else
{
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
return
WebContext
.
forward
(
"forwardMyProfile"
);
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/RegistrationController.java
浏览文件 @
f3b799e7
...
...
@@ -6,7 +6,7 @@ import org.apache.commons.mail.DefaultAuthenticator;
import
org.apache.commons.mail.EmailException
;
import
org.apache.commons.mail.HtmlEmail
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.constants.
STATUS
;
import
org.maxkey.constants.
ConstantsStatus
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.dao.service.RegistrationService
;
...
...
@@ -136,7 +136,7 @@ public class RegistrationController {
userInfo
.
setWorkPhoneNumber
(
registration
.
getWorkPhone
());
userInfo
.
setEmail
(
registration
.
getWorkEmail
());
userInfo
.
setStatus
(
STATUS
.
ACTIVE
);
userInfo
.
setStatus
(
ConstantsStatus
.
ACTIVE
);
String
rawPassword
=
PasswordReciprocal
.
getInstance
().
rawPassword
(
userInfo
.
getUsername
(),
password
);
userInfo
.
setDecipherable
(
ReciprocalUtils
.
encode
(
rawPassword
));
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SafeController.java
浏览文件 @
f3b799e7
package
org.maxkey.web.contorller
;
import
org.maxkey.constants.
OPERATEMESSAGE
;
import
org.maxkey.constants.
ConstantsOperateMessage
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.dao.service.UserInfoService
;
...
...
@@ -47,9 +47,9 @@ public class SafeController {
@RequestParam
(
"confirmPassword"
)
String
confirmPassword
)
{
if
(
changeUserPassword
(
oldPassword
,
newPassword
,
confirmPassword
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
...
...
@@ -66,7 +66,7 @@ public class SafeController {
}
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
return
modelAndView
;
}
...
...
@@ -84,7 +84,7 @@ public class SafeController {
//modelAndView.setViewName("index");
}
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
return
modelAndView
;
}
...
...
@@ -130,11 +130,11 @@ public class SafeController {
userInfo
.
setAppLoginPassword
(
ReciprocalUtils
.
encode
(
newPassword
));
boolean
change
=
userInfoService
.
changeAppLoginPassword
(
userInfo
);
_logger
.
debug
(
""
+
change
);
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
prompt
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
prompt
);
}
}
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_ERROR
),
MessageType
.
error
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
...
...
@@ -164,7 +164,7 @@ public class SafeController {
userInfo
.
setEmail
(
email
);
userInfoService
.
changeEmail
(
userInfo
);
return
new
Message
(
WebContext
.
getI18nValue
(
OPERATEMESSAGE
.
UPDATE_SUCCESS
),
MessageType
.
success
);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/IndexEndpoint.java
浏览文件 @
f3b799e7
package
org.maxkey.web.endpoint
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.constants.
PASSWORDSETTYPE
;
import
org.maxkey.constants.
ConstantsPasswordSetType
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.web.WebConstants
;
import
org.maxkey.web.WebContext
;
...
...
@@ -31,7 +31,7 @@ public class IndexEndpoint {
_logger
.
debug
(
"IndexEndpoint /forwardindex."
);
ModelAndView
modelAndView
=
new
ModelAndView
();
Integer
passwordSetType
=(
Integer
)
WebContext
.
getSession
().
getAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
);
if
(
passwordSetType
==
null
||
passwordSetType
==
PASSWORDSETTYPE
.
PASSWORD_NORMAL
){
if
(
passwordSetType
==
null
||
passwordSetType
==
ConstantsPasswordSetType
.
PASSWORD_NORMAL
){
if
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
()!=
null
&&
!
applicationConfig
.
getLoginConfig
().
getDefaultUri
().
equals
(
""
)){
if
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
().
startsWith
(
"http"
)){
...
...
@@ -45,11 +45,11 @@ public class IndexEndpoint {
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
modelAndView
.
addObject
(
"model"
,
userInfo
);
if
(
passwordSetType
==
PASSWORDSETTYPE
.
PASSWORD_EXPIRED
){
if
(
passwordSetType
==
ConstantsPasswordSetType
.
PASSWORD_EXPIRED
){
modelAndView
.
setViewName
(
"passwordExpired"
);
return
modelAndView
;
}
else
if
(
passwordSetType
==
PASSWORDSETTYPE
.
INITIAL_PASSWORD
||
passwordSetType
==
PASSWORDSETTYPE
.
MANAGER_CHANGED_PASSWORD
){
}
else
if
(
passwordSetType
==
ConstantsPasswordSetType
.
INITIAL_PASSWORD
||
passwordSetType
==
ConstantsPasswordSetType
.
MANAGER_CHANGED_PASSWORD
){
modelAndView
.
setViewName
(
"passwordInitial"
);
return
modelAndView
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录