Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loginservice
Overview
Overview
Details
Activity
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
lanmw
loginservice
Commits
d6bfa9c1
Commit
d6bfa9c1
authored
Jun 03, 2021
by
chenzx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单点登录跳转配置首页地址
parent
bcb3b51f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
RESTAuthenticationSuccessHandler.java
...eymobile/proxy/conf/RESTAuthenticationSuccessHandler.java
+3
-1
SecurityConfig.java
src/main/java/com/keymobile/proxy/conf/SecurityConfig.java
+12
-2
application-test.yml
src/main/resources/application-test.yml
+5
-3
No files found.
src/main/java/com/keymobile/proxy/conf/RESTAuthenticationSuccessHandler.java
View file @
d6bfa9c1
...
...
@@ -22,6 +22,8 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
@Value
(
"${security.allowRootLogin:true}"
)
private
boolean
rootAllowLogin
=
true
;
@Value
(
"${sso.go}"
)
private
String
go
;
@Override
public
void
onAuthenticationSuccess
(
HttpServletRequest
request
,
HttpServletResponse
response
,
...
...
@@ -37,7 +39,7 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
returnStatus
=
"root not allow login"
;
//单点登录认证成功直接跳转首页
response
.
sendRedirect
(
"/go"
);
response
.
sendRedirect
(
go
);
PrintWriter
writer
=
response
.
getWriter
();
writer
.
write
(
returnStatus
);
...
...
src/main/java/com/keymobile/proxy/conf/SecurityConfig.java
View file @
d6bfa9c1
...
...
@@ -41,8 +41,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
private
RESTAuthenticationFailureHandler
authenticationFailureHandler
;
@Autowired
private
RESTAuthenticationSuccessHandler
authenticationSuccessHandler
;
//
@Autowired
//
private RESTLogoutSuccessHandler logoutSuccessHandler;
@Autowired
private
RESTLogoutSuccessHandler
logoutSuccessHandler
;
@Autowired
private
AuthService
authService
;
...
...
@@ -58,7 +58,17 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
authorizeRequests
().
anyRequest
().
permitAll
();
http
.
csrf
().
disable
();
http
.
exceptionHandling
().
authenticationEntryPoint
(
authenticationEntryPoint
);
http
.
formLogin
().
successHandler
(
authenticationSuccessHandler
);
http
.
formLogin
().
failureHandler
(
authenticationFailureHandler
);
http
.
formLogin
().
loginPage
(
"/login"
);
http
.
formLogin
().
loginProcessingUrl
(
"/signin"
);
http
.
logout
().
logoutUrl
(
"/signout"
);
http
.
logout
().
logoutSuccessHandler
(
logoutSuccessHandler
);
http
.
sessionManagement
().
maximumSessions
(
1
).
expiredUrl
(
"/login"
);
}
public
static
String
baseUrl
=
"http://cas.zua.edu.cn/oauth2.0/authorize?response_type=code&client_id=tVnAsJna9Y&redirect_uri=http://10.60.60.127:8091/api/auth/sso"
;
...
...
src/main/resources/application-test.yml
View file @
d6bfa9c1
...
...
@@ -27,9 +27,9 @@ spring:
testWhileIdle
:
true
#在空闲时检查有效性, 默认false
password
:
datasource
:
url
:
jdbc:mysql://1
92.168.0.192:3306/sdrcb
?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8
username
:
tes
t
password
:
test
url
:
jdbc:mysql://1
39.198.127.54:9306/dev0
?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8
username
:
roo
t
password
:
dataSharing
hikari
:
maximum-pool-size
:
3
mvc
:
...
...
@@ -44,6 +44,7 @@ eureka:
registryFetchIntervalSeconds
:
5
serviceUrl
:
defaultZone
:
http://192.168.0.41:8081/eureka/
enabled
:
false
zuul
:
prefix
:
/api
...
...
@@ -59,6 +60,7 @@ security:
sso
:
url
:
http://localhost:8764/token
go
:
http://localhost:8764/token
client
:
id
:
tVnAsJna9Y
...
...
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