Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sh-ds
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李良停
sh-ds
Commits
ca782b17
Commit
ca782b17
authored
Mar 17, 2021
by
曹雷
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
38844234
085f5fd6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
144 deletions
+81
-144
AuthController.java
...eall/eden/authcenter/agent/controller/AuthController.java
+46
-99
loginsuccess.html
...nter-agent/src/main/resources/templates/loginsuccess.html
+35
-45
No files found.
eden-authcenter-agent/src/main/java/com/chineseall/eden/authcenter/agent/controller/AuthController.java
View file @
ca782b17
...
...
@@ -38,7 +38,7 @@ import java.util.function.Function;
import
java.util.stream.Collectors
;
@Controller
@RequestMapping
(
"
auth
"
)
@RequestMapping
(
"
/
"
)
public
class
AuthController
{
Logger
logger
=
Logger
.
getLogger
(
AuthController
.
class
);
...
...
@@ -53,76 +53,22 @@ public class AuthController {
private
AuthLogService
authLogService
;
// @RequestMapping("index")
// public ModelAndView index(HttpServletRequest request, HttpServletResponse response) {
// ModelAndView modelAndView = new ModelAndView();
// modelAndView.setViewName("index2");
// Map<String, ClientItem> clientItemMap = oauthClient.getClients().stream().collect(Collectors.toMap(ClientItem::getClientId, Function.identity()));
// try {
// String clientId = request.getParameter("client_id");
// String returnUrl = request.getParameter("redirect_uri");
// ClientItem clientItem = clientItemMap.get(clientId);
// AuthLog authLog = new AuthLog();
// authLog.setLogType(LogType.login);
// if (null == clientItem) {
// modelAndView.setViewName("error");
// modelAndView.addObject("message", "client_id为空或者不正确");
// return modelAndView;
// }
// authLog.setClientId(clientId);
// authLog.setAuthSource(clientItem.getClientName());
// String sign = request.getParameter("sign");
// String signOrigin = clientItem.getClientId() + "$$" + clientItem.getClientSecret();
//
// String md5Hex = EncodeUtil.md5(signOrigin);
// if (!Objects.equals(sign, md5Hex)) {
// modelAndView.setViewName("error");
// modelAndView.addObject("message", "请求不合法");
// return modelAndView;
// }
// if (StringUtils.isEmpty(returnUrl)) {
// modelAndView.setViewName("error");
// modelAndView.addObject("message", "登录成功回调地址为空");
// return modelAndView;
// }
// String loginType = request.getParameter("login_type");
// if(StringUtils.isNotEmpty(loginType) && OauthType.getValue(loginType)!=null) {
// OauthConfigItem oauthConfigItem = oauthConfig.getItems().get(OauthType.getValue(loginType).getCode());
// authLog.setFowardUrl(oauthConfigItem.getOauthUrl());
// authLog.setOauthType(OauthType.getValue(loginType).getCode());
// // 阅览室日志分离
// ClientItem item = clientItemMap.get("readingroomClientId");
// authLog.setAuthSource(item.getClientName());
// authLogService.save(authLog);
// response.sendRedirect(generateLoginUrl(returnUrl, OauthType.getValue(loginType).getCode(), authLog.getId()));
// return null;
// } else {
// authLogService.save(authLog);
// String url1 = generateLoginUrl(returnUrl, OauthType.dianjiaoguan.getCode(), authLog.getId());
// modelAndView.addObject("loginUrl1", url1);
// String url2 = generateLoginUrl(returnUrl, OauthType.edenoperation.getCode(), authLog.getId());
// modelAndView.addObject("loginUrl2", url2);
// modelAndView.addObject("logId", authLog.getId());
// }
// } catch (Exception e) {
// e.printStackTrace();
// modelAndView.setViewName("error");
// modelAndView.addObject("message", "未知错误");
// }
// return modelAndView;
// }
@RequestMapping
(
"index"
)
@RequestMapping
(
value
=
{
""
,
"auth"
,
"auth/index"
})
public
ModelAndView
index
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
ModelAndView
modelAndView
=
new
ModelAndView
();
modelAndView
.
setViewName
(
"ds"
);
Map
<
String
,
ClientItem
>
clientItemMap
=
oauthClient
.
getClients
().
stream
().
collect
(
Collectors
.
toMap
(
ClientItem:
:
getClientId
,
Function
.
identity
()));
try
{
String
clientId
=
request
.
getParameter
(
"client_id"
);
String
returnUrl
=
request
.
getParameter
(
"redirect_uri"
);
ClientItem
clientItem
=
clientItemMap
.
get
(
clientId
);
AuthLog
authLog
=
new
AuthLog
();
authLog
.
setLogType
(
LogType
.
login
);
if
(
StringUtils
.
isNotEmpty
(
clientId
)){
ClientItem
clientItem
=
clientItemMap
.
get
(
clientId
);
if
(
null
==
clientItem
)
{
modelAndView
.
setViewName
(
"error"
);
modelAndView
.
addObject
(
"message"
,
"client_id为空或者不正确"
);
...
...
@@ -156,6 +102,7 @@ public class AuthController {
}
else
{
modelAndView
.
addObject
(
"loginType"
,
""
);
}
}
authLogService
.
save
(
authLog
);
...
...
@@ -175,7 +122,7 @@ public class AuthController {
return
modelAndView
;
}
@RequestMapping
(
"tologin"
)
@RequestMapping
(
"
auth/
tologin"
)
public
ModelAndView
toLogin
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
ModelAndView
modelAndView
=
new
ModelAndView
();
String
loginUrl
=
request
.
getParameter
(
"loginUrl"
);
...
...
@@ -212,7 +159,7 @@ public class AuthController {
return
modelAndView
;
}
@RequestMapping
(
"logout"
)
@RequestMapping
(
"
auth/
logout"
)
public
ModelAndView
logout
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
ModelAndView
modelAndView
=
new
ModelAndView
();
modelAndView
.
setViewName
(
"logout"
);
...
...
@@ -279,7 +226,7 @@ public class AuthController {
return
modelAndView
;
}
@RequestMapping
(
value
=
"loginsuccess"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"
auth/
loginsuccess"
,
method
=
RequestMethod
.
GET
)
public
ModelAndView
loginsuccess
(
HttpServletRequest
request
,
HttpServletResponse
response
,
ModelAndView
modelAndView
)
{
modelAndView
.
setViewName
(
"loginsuccess"
);
String
code
=
request
.
getParameter
(
"code"
);
...
...
@@ -364,7 +311,7 @@ public class AuthController {
return
modelAndView
;
}
@RequestMapping
(
value
=
"idp/loginsuccess"
)
@RequestMapping
(
value
=
"
auth/
idp/loginsuccess"
)
public
ModelAndView
idploginsuccess
(
HttpServletRequest
request
,
HttpServletResponse
response
,
ModelAndView
modelAndView
)
{
modelAndView
.
setViewName
(
"loginsuccess"
);
String
code
=
request
.
getParameter
(
"code"
);
...
...
@@ -431,7 +378,7 @@ public class AuthController {
}
@RequestMapping
(
value
=
"logoutsuccess"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"
auth/
logoutsuccess"
,
method
=
RequestMethod
.
GET
)
public
ModelAndView
loginoutsuccess
(
HttpServletRequest
request
,
HttpServletResponse
response
,
ModelAndView
modelAndView
)
throws
IOException
{
String
returnUrl
=
request
.
getParameter
(
"return_url"
);
if
(
StringUtils
.
isNotEmpty
(
returnUrl
)){
...
...
@@ -591,7 +538,7 @@ public class AuthController {
return
newUrl
;
}
@RequestMapping
(
"shauth"
)
@RequestMapping
(
"
auth/
shauth"
)
public
ModelAndView
chineseallLogin
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
ModelAndView
modelAndView
=
new
ModelAndView
();
modelAndView
.
setViewName
(
"toward"
);
...
...
@@ -637,7 +584,7 @@ public class AuthController {
return
modelAndView
;
}
@RequestMapping
(
"shlogout"
)
@RequestMapping
(
"
auth/
shlogout"
)
public
ModelAndView
shLogout
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
ModelAndView
modelAndView
=
new
ModelAndView
();
modelAndView
.
setViewName
(
"logout"
);
...
...
eden-authcenter-agent/src/main/resources/templates/loginsuccess.html
View file @
ca782b17
...
...
@@ -15,8 +15,7 @@
<!--<script src="../js/vendor/modernizr-2.6.2.min.js"></script>-->
</head>
<body>
<div>
<!-- <form th:action="${successPostUrl}" method="post" th:object="${clientDataInfo}">
<form
th:action=
"${successPostUrl}"
method=
"post"
th:object=
"${clientDataInfo}"
>
<input
type=
"hidden"
th:value=
"${clientDataInfo.authUserInfo.id}"
name=
"authUserInfo.id"
/>
<input
type=
"hidden"
th:value=
"${clientDataInfo.authUserInfo.realName}"
name=
"authUserInfo.realName"
/>
<input
type=
"hidden"
th:value=
"${clientDataInfo.authUserInfo.userType}"
name=
"authUserInfo.userType"
/>
...
...
@@ -47,20 +46,11 @@
<input
type=
"hidden"
th:value=
"${clientDataInfo.authUserInfo.teacherSchoolName}"
name=
"authUserInfo.teacherSchoolName"
/>
<input
type=
"hidden"
th:value=
"${clientDataInfo.returnUrl}"
name=
"returnUrl"
/>
<input
type=
"hidden"
th:value=
"${clientDataInfo.oauthType}"
name=
"oauthType"
/>
</form> -->
<p
style=
"font-size: 26px; text-align:center"
>
尊敬的
<span
th:value=
"${clientDataInfo.authUserInfo.realName}"
></span>
(id:
<span
th:value=
"${clientDataInfo.authUserInfo.id}"
></span>
),恭喜您通过
<span
th:if=
"${clientDataInfo.authUserInfo.source} == 'edenoperation'"
>
上海数字教材
</span>
<span
th:if=
"${clientDataInfo.authUserInfo.source} == 'dianjiaoguan'"
>
上海基础教育
</span>
<span
th:if=
"${clientDataInfo.authUserInfo.source} == 'qpjy'"
>
青浦教育
</span>
登录成功!
</p>
</div>
</form>
<script
type=
"text/javascript"
>
//
$(function(){
//
$("form").submit();
//
})
$
(
function
(){
$
(
"form"
).
submit
();
})
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment