Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
d194c919
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,发现更多精彩内容 >>
提交
d194c919
编写于
8月 31, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CHANGED_PASSWORD
上级
edec66c2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
51 deletion
+54
-51
maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java
...-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java
+1
-0
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SafeController.java
...c/main/java/org/maxkey/web/contorller/SafeController.java
+19
-11
maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/IndexEndpoint.java
.../src/main/java/org/maxkey/web/endpoint/IndexEndpoint.java
+8
-40
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PermissionAdapter.java
...in/java/org/maxkey/web/interceptor/PermissionAdapter.java
+26
-0
未找到文件。
maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java
浏览文件 @
d194c919
...
...
@@ -85,6 +85,7 @@ public class MaxKeyMvcConfig implements WebMvcConfigurer {
.
addPathPatterns
(
"/profile/**"
)
.
addPathPatterns
(
"/safe/**"
)
.
addPathPatterns
(
"/historys/**"
)
.
addPathPatterns
(
"/appList"
)
.
addPathPatterns
(
"/appList/**"
)
.
addPathPatterns
(
"/socialsignon/**"
)
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SafeController.java
浏览文件 @
d194c919
...
...
@@ -21,6 +21,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
org.maxkey.constants.ConstantsOperateMessage
;
import
org.maxkey.constants.ConstantsPasswordSetType
;
import
org.maxkey.constants.ConstantsTimeInterval
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
...
...
@@ -77,17 +78,20 @@ public class SafeController {
@RequestMapping
(
value
=
"/changeExpiredPassword"
)
public
ModelAndView
changeExpiredPassword
(
@RequestParam
(
value
=
"oldPassword"
,
required
=
false
)
String
oldPassword
,
@RequestParam
(
"newPassword"
)
String
newPassword
,
@RequestParam
(
"confirmPassword"
)
String
confirmPassword
)
{
@RequestParam
(
value
=
"oldPassword"
,
required
=
false
)
String
oldPassword
,
@RequestParam
(
value
=
"newPassword"
,
required
=
false
)
String
newPassword
,
@RequestParam
(
value
=
"confirmPassword"
,
required
=
false
)
String
confirmPassword
)
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"passwordExpired"
);
if
(
changeUserPassword
(
oldPassword
,
newPassword
,
confirmPassword
)){
if
(
newPassword
==
null
||
newPassword
.
equals
(
""
))
{
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
modelAndView
.
addObject
(
"model"
,
userInfo
);
return
modelAndView
;
}
else
if
(
changeUserPassword
(
oldPassword
,
newPassword
,
confirmPassword
)){
WebContext
.
getSession
().
setAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
,
ConstantsPasswordSetType
.
PASSWORD_NORMAL
);
return
WebContext
.
redirect
(
"/index"
);
//modelAndView.setViewName("index");
}
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
return
modelAndView
;
...
...
@@ -97,11 +101,15 @@ public class SafeController {
@RequestMapping
(
value
=
"/changeInitPassword"
)
public
ModelAndView
changeInitPassword
(
@RequestParam
(
value
=
"oldPassword"
,
required
=
false
)
String
oldPassword
,
@RequestParam
(
"newPassword"
)
String
newPassword
,
@RequestParam
(
"confirmPassword"
)
String
confirmPassword
)
{
@RequestParam
(
value
=
"newPassword"
,
required
=
false
)
String
newPassword
,
@RequestParam
(
value
=
"confirmPassword"
,
required
=
false
)
String
confirmPassword
)
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"passwordInitial"
);
if
(
changeUserPassword
(
oldPassword
,
newPassword
,
confirmPassword
)){
if
(
newPassword
==
null
||
newPassword
.
equals
(
""
))
{
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
modelAndView
.
addObject
(
"model"
,
userInfo
);
return
modelAndView
;
}
else
if
(
changeUserPassword
(
oldPassword
,
newPassword
,
confirmPassword
)){
WebContext
.
getSession
().
setAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
,
ConstantsPasswordSetType
.
PASSWORD_NORMAL
);
return
WebContext
.
redirect
(
"/index"
);
//modelAndView.setViewName("index");
}
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/IndexEndpoint.java
浏览文件 @
d194c919
...
...
@@ -24,9 +24,6 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
org.maxkey.configuration.ApplicationConfig
;
import
org.maxkey.constants.ConstantsPasswordSetType
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.web.WebConstants
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -51,49 +48,20 @@ public class IndexEndpoint {
@RequestMapping
(
value
={
"/forwardindex"
})
public
ModelAndView
forwardindex
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
_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
==
ConstantsPasswordSetType
.
PASSWORD_NORMAL
){
if
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
()!=
null
&&
!
applicationConfig
.
getLoginConfig
().
getDefaultUri
().
equals
(
""
)){
if
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
().
startsWith
(
"http"
)){
return
WebContext
.
redirect
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
());
}
return
WebContext
.
redirect
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
());
}
modelAndView
.
setViewName
(
"index"
);
return
modelAndView
;
}
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
modelAndView
.
addObject
(
"model"
,
userInfo
);
if
(
passwordSetType
==
ConstantsPasswordSetType
.
PASSWORD_EXPIRED
||
passwordSetType
==
ConstantsPasswordSetType
.
MANAGER_CHANGED_PASSWORD
){
modelAndView
.
setViewName
(
"passwordExpired"
);
return
modelAndView
;
}
else
if
(
passwordSetType
==
ConstantsPasswordSetType
.
INITIAL_PASSWORD
){
modelAndView
.
setViewName
(
"passwordInitial"
);
return
modelAndView
;
}
return
new
ModelAndView
(
"index"
);
String
defaultUri
=
applicationConfig
.
getLoginConfig
().
getDefaultUri
();
if
(
defaultUri
!=
null
&&
!
defaultUri
.
equals
(
""
))
{
_logger
.
debug
(
"defaultUri "
+
defaultUri
);
return
WebContext
.
redirect
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
());
}
_logger
.
debug
(
"Uri /appList"
);
return
new
ModelAndView
(
"/appList"
);
}
@RequestMapping
(
value
={
"/index"
})
public
ModelAndView
home
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
_logger
.
debug
(
"IndexEndpoint /index."
);
if
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
()!=
null
&&
!
applicationConfig
.
getLoginConfig
().
getDefaultUri
().
equals
(
""
)
){
return
WebContext
.
redirect
(
applicationConfig
.
getLoginConfig
().
getDefaultUri
());
}
_logger
.
debug
(
"home /index."
);
return
new
ModelAndView
(
"index"
);
}
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PermissionAdapter.java
浏览文件 @
d194c919
...
...
@@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletResponse;
import
org.maxkey.authn.SavedRequestAwareAuthenticationSuccessHandler
;
import
org.maxkey.configuration.ApplicationConfig
;
import
org.maxkey.constants.ConstantsPasswordSetType
;
import
org.maxkey.web.WebConstants
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
...
...
@@ -70,6 +71,31 @@ public class PermissionAdapter extends HandlerInterceptorAdapter {
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
_logger
.
trace
(
"PermissionAdapter preHandle"
);
Object
passwordSetTypeAttribute
=
WebContext
.
getSession
().
getAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
);
if
(
passwordSetTypeAttribute
!=
null
)
{
Integer
passwordSetType
=(
Integer
)
passwordSetTypeAttribute
;
if
(
passwordSetType
==
ConstantsPasswordSetType
.
PASSWORD_EXPIRED
||
passwordSetType
==
ConstantsPasswordSetType
.
MANAGER_CHANGED_PASSWORD
){
_logger
.
trace
(
"changeExpiredPassword ... forward to /safe/changeExpiredPassword"
);
if
(
request
.
getRequestURI
().
indexOf
(
"/changeExpiredPassword"
)>-
1
)
{
return
true
;
}
RequestDispatcher
dispatcher
=
request
.
getRequestDispatcher
(
"/safe/changeExpiredPassword"
);
dispatcher
.
forward
(
request
,
response
);
return
false
;
}
else
if
(
passwordSetType
==
ConstantsPasswordSetType
.
INITIAL_PASSWORD
){
_logger
.
trace
(
"changeInitPassword ... forward to /safe/changeInitPassword"
);
if
(
request
.
getRequestURI
().
indexOf
(
"/changeInitPassword"
)>-
1
)
{
return
true
;
}
RequestDispatcher
dispatcher
=
request
.
getRequestDispatcher
(
"/safe/changeInitPassword"
);
dispatcher
.
forward
(
request
,
response
);
return
false
;
}
}
//save first protected url
SavedRequest
firstSavedRequest
=
(
SavedRequest
)
WebContext
.
getAttribute
(
WebConstants
.
FIRST_SAVED_REQUEST_PARAMETER
);
// 判断用户是否登录, 判断用户和角色,判断用户是否登录用户
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录