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
2725aee3
Commit
2725aee3
authored
Mar 15, 2021
by
喻春霖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed
parent
3ea3d50d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
AuthController.java
...eall/eden/authcenter/agent/controller/AuthController.java
+28
-4
application.yml
eden-authcenter-agent/src/main/resources/application.yml
+1
-1
No files found.
eden-authcenter-agent/src/main/java/com/chineseall/eden/authcenter/agent/controller/AuthController.java
View file @
2725aee3
...
...
@@ -261,10 +261,14 @@ public class AuthController {
authLogService
.
save
(
authLog
);
if
(
StringUtils
.
isNotEmpty
(
service
))
{
if
(!
OauthType
.
dianjiaoguan
.
equals
(
type
)
&&
!
OauthType
.
edenoperation
.
equals
(
type
)){
response
.
sendRedirect
(
service
);
if
(
OauthType
.
qpjy
.
equals
(
type
)){
response
.
sendRedirect
(
generateSpLogoutUrl
(
service
,
type
.
name
()));
}
}
else
{
response
.
sendRedirect
(
generateLogoutUrl
(
service
,
type
.
name
()));
//response.sendRedirect(service);
}
}
return
null
;
}
catch
(
Exception
e
)
{
...
...
@@ -470,7 +474,7 @@ public class AuthController {
if
(!
oauthConfigItem
.
getOauthUrl
().
endsWith
(
"/"
))
{
loginUrlBuilder
.
append
(
"/"
);
}
loginUrlBuilder
.
append
(
"?client_id="
).
append
(
oauthConfigItem
.
getClientId
());
loginUrlBuilder
.
append
(
"
login
?client_id="
).
append
(
oauthConfigItem
.
getClientId
());
String
loginSuccessUrl
=
oauthConfigItem
.
getLoginSuccessUrl
();
loginSuccessUrl
=
loginSuccessUrl
+
"?log_id="
+
logId
+
"&oauth_type="
+
oauthType
;
if
(
StringUtils
.
isNotEmpty
(
returnUrl
))
{
...
...
@@ -503,6 +507,26 @@ public class AuthController {
return
loginUrlBuilder
.
toString
();
}
private
String
generateSpLogoutUrl
(
String
returnUrl
,
String
oauthType
)
{
StringBuilder
loginUrlBuilder
=
new
StringBuilder
();
OauthConfigItem
oauthConfigItem
=
oauthConfig
.
getItems
().
get
(
oauthType
);
loginUrlBuilder
.
append
(
oauthConfigItem
.
getOauthUrl
());
if
(!
oauthConfigItem
.
getOauthUrl
().
endsWith
(
"/"
))
{
loginUrlBuilder
.
append
(
"/"
);
}
String
service
=
oauthConfigItem
.
getLogoutSuccessUrl
();
if
(
StringUtils
.
isNotEmpty
(
returnUrl
))
{
Map
<
String
,
String
>
param
=
new
HashMap
<>();
param
.
put
(
"return_url"
,
URLEncoder
.
encode
(
returnUrl
));
service
=
appendUrl
(
service
,
param
);
}
loginUrlBuilder
.
append
(
"logout?service="
).
append
(
URLEncoder
.
encode
(
service
));
return
loginUrlBuilder
.
toString
();
}
private
String
generateUserInfoUrl
(
String
accessToken
,
String
oauthType
)
{
//String url = "http://castest.edu.sh.cn/CAS/oauth2.0/accessToken?client_id=testClentId&client_secret=testClientSecret&redirect_uri=http%3a%2f%2f192.168.17.129%3a7774%2fauth%2floginsuccess2.do&code=" + code;
StringBuilder
builder
=
new
StringBuilder
();
...
...
eden-authcenter-agent/src/main/resources/application.yml
View file @
2725aee3
...
...
@@ -44,7 +44,7 @@ oauth:
logoutSuccessUrl
:
https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
qpjy
:
#idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl
:
https://sp.etextbook.cn/authcenter/auth
/login
oauthUrl
:
https://sp.etextbook.cn/authcenter/auth
clientId
:
dsClentId
clientSecret
:
VjyqUkkM5Znu
loginSuccessUrl
:
https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
...
...
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