Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
e7830312
apollo
项目概览
wrr-cat
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e7830312
编写于
6月 24, 2016
作者:
J
Jason Song
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add mechanism to keep sso auto login
上级
bf5dd4cc
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
41 addition
and
13 deletion
+41
-13
apollo-common/src/main/java/com/ctrip/framework/apollo/common/auth/WebSecurityConfig.java
...ctrip/framework/apollo/common/auth/WebSecurityConfig.java
+1
-0
apollo-portal/pom.xml
apollo-portal/pom.xml
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/auth/CtripLogoutHandler.java
...trip/framework/apollo/portal/auth/CtripLogoutHandler.java
+5
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/configutation/AuthConfiguration.java
...mework/apollo/portal/configutation/AuthConfiguration.java
+6
-2
apollo-portal/src/main/resources/static/scripts/AppUtils.js
apollo-portal/src/main/resources/static/scripts/AppUtils.js
+1
-1
apollo-portal/src/main/resources/static/sso_heartbeat.html
apollo-portal/src/main/resources/static/sso_heartbeat.html
+22
-0
apollo-portal/src/main/resources/static/views/common/footer.html
...portal/src/main/resources/static/views/common/footer.html
+1
-4
pom.xml
pom.xml
+3
-3
未找到文件。
apollo-common/src/main/java/com/ctrip/framework/apollo/common/auth/WebSecurityConfig.java
浏览文件 @
e7830312
...
...
@@ -17,6 +17,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
httpBasic
();
http
.
csrf
().
disable
();
http
.
headers
().
frameOptions
().
sameOrigin
();
}
@Autowired
...
...
apollo-portal/pom.xml
浏览文件 @
e7830312
...
...
@@ -66,8 +66,8 @@
</properties>
<dependencies>
<dependency>
<groupId>
org.jasig.cas.client
</groupId>
<artifactId>
cas-client-core-infosec-credis
</artifactId>
<groupId>
com.ctrip.framework.apollo-sso
</groupId>
<artifactId>
apollo-sso-ctrip
</artifactId>
</dependency>
</dependencies>
</profile>
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/auth/CtripLogoutHandler.java
浏览文件 @
e7830312
...
...
@@ -9,6 +9,7 @@ import java.io.IOException;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
public
class
CtripLogoutHandler
implements
LogoutHandler
{
...
...
@@ -18,7 +19,10 @@ public class CtripLogoutHandler implements LogoutHandler{
@Override
public
void
logout
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
//将session销毁
request
.
getSession
().
invalidate
();
HttpSession
session
=
request
.
getSession
(
false
);
if
(
session
!=
null
)
{
session
.
invalidate
();
}
Cookie
cookie
=
new
Cookie
(
"memCacheAssertionID"
,
null
);
//将cookie的有效期设置为0,命令浏览器删除该cookie
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/configutation/AuthConfiguration.java
浏览文件 @
e7830312
...
...
@@ -73,9 +73,11 @@ public class AuthConfiguration {
filterInitParam
.
put
(
"redisClusterName"
,
"casClientPrincipal"
);
filterInitParam
.
put
(
"serverName"
,
serverConfigService
.
getValue
(
"serverName"
));
filterInitParam
.
put
(
"casServerLoginUrl"
,
serverConfigService
.
getValue
(
"casServerLoginUrl"
));
//we don't want to use session to store login information, since we will be deployed to a cluster, not a single instance
filterInitParam
.
put
(
"useSession"
,
"false"
);
casFilter
.
setInitParameters
(
filterInitParam
);
casFilter
.
setFilter
(
filter
(
"
org.jasig.cas.client.authentication.
AuthenticationFilter"
));
casFilter
.
setFilter
(
filter
(
"
com.ctrip.framework.apollo.sso.filter.Apollo
AuthenticationFilter"
));
casFilter
.
addUrlPatterns
(
"/*"
);
return
casFilter
;
...
...
@@ -88,6 +90,8 @@ public class AuthConfiguration {
filterInitParam
.
put
(
"casServerUrlPrefix"
,
serverConfigService
.
getValue
(
"casServerUrlPrefix"
));
filterInitParam
.
put
(
"serverName"
,
serverConfigService
.
getValue
(
"serverName"
));
filterInitParam
.
put
(
"encoding"
,
"UTF-8"
);
//we don't want to use session to store login information, since we will be deployed to a cluster, not a single instance
filterInitParam
.
put
(
"useSession"
,
"false"
);
filterInitParam
.
put
(
"useRedis"
,
"true"
);
filterInitParam
.
put
(
"redisClusterName"
,
"casClientPrincipal"
);
...
...
@@ -105,7 +109,7 @@ public class AuthConfiguration {
public
FilterRegistrationBean
assertionHolder
(){
FilterRegistrationBean
assertionHolderFilter
=
new
FilterRegistrationBean
();
assertionHolderFilter
.
setFilter
(
filter
(
"
org.jasig.cas.client.util.
AssertionThreadLocalFilter"
));
assertionHolderFilter
.
setFilter
(
filter
(
"
com.ctrip.framework.apollo.sso.filter.Apollo
AssertionThreadLocalFilter"
));
assertionHolderFilter
.
addUrlPatterns
(
"/*"
);
return
assertionHolderFilter
;
...
...
apollo-portal/src/main/resources/static/scripts/AppUtils.js
浏览文件 @
e7830312
...
...
@@ -3,7 +3,7 @@ appUtil.service('AppUtil', ['toastr', function (toastr) {
return
{
errorMsg
:
function
(
response
)
{
if
(
response
.
status
==
-
1
)
{
return
"
您的登录信息已过期,请
重新登录
"
;
return
"
您的登录信息已过期,请
刷新页面后重试
"
;
}
var
msg
=
"
Code:
"
+
response
.
status
;
if
(
response
.
data
.
message
!=
null
)
{
...
...
apollo-portal/src/main/resources/static/sso_heartbeat.html
0 → 100644
浏览文件 @
e7830312
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
SSO Heartbeat
</title>
<script
type=
"text/javascript"
>
var
reloading
=
false
;
setInterval
(
function
()
{
if
(
document
.
cookie
.
indexOf
(
'
memCacheAssertionID=
'
)
==
-
1
)
{
if
(
reloading
)
{
return
;
}
reloading
=
true
;
console
.
log
(
"
sso memCacheAssertionID expires, try reloading
"
);
location
.
reload
(
true
);
}
},
1000
);
</script>
</head>
<body>
</body>
</html>
apollo-portal/src/main/resources/static/views/common/footer.html
浏览文件 @
e7830312
...
...
@@ -5,7 +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>
pom.xml
浏览文件 @
e7830312
...
...
@@ -177,9 +177,9 @@
</exclusions>
</dependency>
<dependency>
<groupId>
org.jasig.cas.client
</groupId>
<artifactId>
cas-client-core-infosec-credis
</artifactId>
<version>
3.1.12
</version>
<groupId>
com.ctrip.framework.apollo-sso
</groupId>
<artifactId>
apollo-sso-ctrip
</artifactId>
<version>
1.0.0
</version>
</dependency>
<!--third party -->
<dependency>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录