Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
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
openSource
apollo
Commits
eb199d3a
Commit
eb199d3a
authored
Jun 27, 2016
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamic sso heartbeat controller
parent
d8a4475d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
1 deletion
+93
-1
CtripSsoHeartbeatHandler.java
...ramework/apollo/portal/auth/CtripSsoHeartbeatHandler.java
+19
-0
DefaultSsoHeartbeatHandler.java
...mework/apollo/portal/auth/DefaultSsoHeartbeatHandler.java
+19
-0
SsoHeartbeatHandler.java
...rip/framework/apollo/portal/auth/SsoHeartbeatHandler.java
+11
-0
AuthConfiguration.java
...mework/apollo/portal/configutation/AuthConfiguration.java
+14
-0
SsoHeartbeatController.java
...work/apollo/portal/controller/SsoHeartbeatController.java
+29
-0
ctrip_sso_heartbeat.html
...portal/src/main/resources/static/ctrip_sso_heartbeat.html
+0
-0
footer.html
...portal/src/main/resources/static/views/common/footer.html
+1
-1
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/auth/CtripSsoHeartbeatHandler.java
0 → 100644
View file @
eb199d3a
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
auth
;
import
java.io.IOException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public
class
CtripSsoHeartbeatHandler
implements
SsoHeartbeatHandler
{
@Override
public
void
doHeartbeat
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
try
{
response
.
sendRedirect
(
"ctrip_sso_heartbeat.html"
);
}
catch
(
IOException
e
)
{
}
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/auth/DefaultSsoHeartbeatHandler.java
0 → 100644
View file @
eb199d3a
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
auth
;
import
java.io.IOException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public
class
DefaultSsoHeartbeatHandler
implements
SsoHeartbeatHandler
{
@Override
public
void
doHeartbeat
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
try
{
response
.
getWriter
().
write
(
"default sso heartbeat handler"
);
}
catch
(
IOException
e
)
{
}
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/auth/SsoHeartbeatHandler.java
0 → 100644
View file @
eb199d3a
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
auth
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public
interface
SsoHeartbeatHandler
{
void
doHeartbeat
(
HttpServletRequest
request
,
HttpServletResponse
response
);
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/configutation/AuthConfiguration.java
View file @
eb199d3a
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
configutation
;
import
com.ctrip.framework.apollo.portal.auth.CtripLogoutHandler
;
import
com.ctrip.framework.apollo.portal.auth.CtripSsoHeartbeatHandler
;
import
com.ctrip.framework.apollo.portal.auth.CtripUserInfoHolder
;
import
com.ctrip.framework.apollo.portal.auth.CtripUserService
;
import
com.ctrip.framework.apollo.portal.auth.DefaultLogoutHandler
;
import
com.ctrip.framework.apollo.portal.auth.DefaultSsoHeartbeatHandler
;
import
com.ctrip.framework.apollo.portal.auth.DefaultUserInfoHolder
;
import
com.ctrip.framework.apollo.portal.auth.DefaultUserService
;
import
com.ctrip.framework.apollo.portal.auth.LogoutHandler
;
import
com.ctrip.framework.apollo.portal.auth.SsoHeartbeatHandler
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.service.ServerConfigService
;
import
com.ctrip.framework.apollo.portal.service.UserService
;
...
...
@@ -152,6 +155,11 @@ public class AuthConfiguration {
public
UserService
ctripUserService
(
ServerConfigService
serverConfigService
)
{
return
new
CtripUserService
(
serverConfigService
);
}
@Bean
public
SsoHeartbeatHandler
ctripSsoHeartbeatHandler
()
{
return
new
CtripSsoHeartbeatHandler
();
}
}
/**
...
...
@@ -161,6 +169,12 @@ public class AuthConfiguration {
static
class
DefaultAuthAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
(
SsoHeartbeatHandler
.
class
)
public
SsoHeartbeatHandler
defaultSsoHeartbeatHandler
()
{
return
new
DefaultSsoHeartbeatHandler
();
}
@Bean
@ConditionalOnMissingBean
(
UserInfoHolder
.
class
)
public
DefaultUserInfoHolder
notCtripUserInfoHolder
(){
return
new
DefaultUserInfoHolder
();
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SsoHeartbeatController.java
0 → 100644
View file @
eb199d3a
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
controller
;
import
com.ctrip.framework.apollo.portal.auth.SsoHeartbeatHandler
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* Since sso auth information has a limited expiry time, so we need to do sso heartbeat to keep the
* information refreshed when unavailable
*
* @author Jason Song(song_s@ctrip.com)
*/
@Controller
@RequestMapping
(
"/sso_heartbeat"
)
public
class
SsoHeartbeatController
{
@Autowired
private
SsoHeartbeatHandler
handler
;
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
void
heartbeat
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
handler
.
doHeartbeat
(
request
,
response
);
}
}
apollo-portal/src/main/resources/static/sso_heartbeat.html
→
apollo-portal/src/main/resources/static/
ctrip_
sso_heartbeat.html
View file @
eb199d3a
File moved
apollo-portal/src/main/resources/static/views/common/footer.html
View file @
eb199d3a
...
...
@@ -5,4 +5,4 @@
<a
href=
"http://conf.ctripcorp.com/display/FRAM/Apollo"
target=
"_blank"
>
wiki
</a>
</p>
</div>
<iframe
src=
"/sso_heartbeat
.html
"
class=
"hide"
></iframe>
<iframe
src=
"/sso_heartbeat"
class=
"hide"
></iframe>
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