Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
superrain51
apollo
提交
bf496b4f
apollo
项目概览
superrain51
/
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,发现更多精彩内容 >>
提交
bf496b4f
编写于
10月 09, 2017
作者:
张
张乐
提交者:
GitHub
10月 09, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #782 from nobodyiam/remove-useless-authentication-codes
remove useless authentication codes
上级
2650b3c0
0f03174c
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
20 addition
and
43 deletion
+20
-43
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java
...pollo/adminservice/controller/AbstractControllerTest.java
+1
-1
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java
...apollo/adminservice/controller/ItemSetControllerTest.java
+5
-5
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/TestWebSecurityConfig.java
...apollo/adminservice/controller/TestWebSecurityConfig.java
+0
-11
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/auth/WebSecurityConfig.java
...om/ctrip/framework/apollo/biz/auth/WebSecurityConfig.java
+7
-0
apollo-client/src/main/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
...n/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
+5
-16
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/TestWebSecurityConfig.java
...pollo/configservice/controller/TestWebSecurityConfig.java
+0
-8
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/AbstractBaseIntegrationTest.java
...onfigservice/integration/AbstractBaseIntegrationTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/AbstractIntegrationTest.java
...trip/framework/apollo/portal/AbstractIntegrationTest.java
+1
-1
未找到文件。
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java
浏览文件 @
bf496b4f
...
...
@@ -23,7 +23,7 @@ public abstract class AbstractControllerTest {
@Autowired
private
HttpMessageConverters
httpMessageConverters
;
RestTemplate
restTemplate
=
new
TestRestTemplate
(
"apollo"
,
""
);
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@PostConstruct
private
void
postConstruct
()
{
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java
浏览文件 @
bf496b4f
...
...
@@ -47,7 +47,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
ItemChangeSets
itemSet
=
new
ItemChangeSets
();
itemSet
.
setDataChangeLastModifiedBy
(
"created"
);
RestTemplate
createdTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
RestTemplate
createdTemplate
=
new
TestRestTemplate
();
createdTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
createdSize
=
3
;
...
...
@@ -96,7 +96,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
ItemChangeSets
createChangeSet
=
new
ItemChangeSets
();
createChangeSet
.
setDataChangeLastModifiedBy
(
"created"
);
RestTemplate
createdRestTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
RestTemplate
createdRestTemplate
=
new
TestRestTemplate
();
createdRestTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
createdSize
=
3
;
...
...
@@ -123,7 +123,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
ItemChangeSets
updateChangeSet
=
new
ItemChangeSets
();
updateChangeSet
.
setDataChangeLastModifiedBy
(
"updated"
);
RestTemplate
updatedRestTemplate
=
new
TestRestTemplate
(
"updated"
,
""
);
RestTemplate
updatedRestTemplate
=
new
TestRestTemplate
();
updatedRestTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
updatedSize
=
2
;
...
...
@@ -170,7 +170,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
ItemChangeSets
createChangeSet
=
new
ItemChangeSets
();
createChangeSet
.
setDataChangeLastModifiedBy
(
"created"
);
RestTemplate
createdTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
RestTemplate
createdTemplate
=
new
TestRestTemplate
();
createdTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
createdSize
=
3
;
...
...
@@ -196,7 +196,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
ItemChangeSets
deleteChangeSet
=
new
ItemChangeSets
();
deleteChangeSet
.
setDataChangeLastModifiedBy
(
"deleted"
);
RestTemplate
deletedTemplate
=
new
TestRestTemplate
(
"deleted"
,
""
);
RestTemplate
deletedTemplate
=
new
TestRestTemplate
();
deletedTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
deletedSize
=
1
;
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/TestWebSecurityConfig.java
浏览文件 @
bf496b4f
package
com.ctrip.framework.apollo.adminservice.controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
...
...
@@ -20,13 +18,4 @@ public class TestWebSecurityConfig extends WebSecurityConfigurerAdapter {
http
.
headers
().
frameOptions
().
disable
();
}
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
inMemoryAuthentication
().
withUser
(
"user"
).
password
(
""
).
roles
(
"USER"
);
auth
.
inMemoryAuthentication
().
withUser
(
"apollo"
).
password
(
""
).
roles
(
"USER"
,
"ADMIN"
);
auth
.
inMemoryAuthentication
().
withUser
(
"created"
).
password
(
""
).
roles
(
"TEST"
);
auth
.
inMemoryAuthentication
().
withUser
(
"updated"
).
password
(
""
).
roles
(
"TEST"
);
auth
.
inMemoryAuthentication
().
withUser
(
"deleted"
).
password
(
""
).
roles
(
"TEST"
);
}
}
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/auth/WebSecurityConfig.java
浏览文件 @
bf496b4f
...
...
@@ -23,6 +23,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
http
.
headers
().
frameOptions
().
sameOrigin
();
}
/**
* Although the authentication below is useless, we may not remove them for backward compatibility.
* Because if we remove them and the old clients(before 0.9.0) still send the authentication
* information, the server will return 401, which should cause big problems.
*
* We may remove the following once we remove spring security from Apollo.
*/
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
inMemoryAuthentication
().
withUser
(
"user"
).
password
(
""
).
roles
(
"USER"
).
and
()
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
浏览文件 @
bf496b4f
package
com.ctrip.framework.apollo.util.http
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.reflect.Type
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
com.ctrip.framework.apollo.build.ApolloInjector
;
import
com.ctrip.framework.apollo.exceptions.ApolloConfigException
;
import
com.ctrip.framework.apollo.exceptions.ApolloConfigStatusCodeException
;
import
com.ctrip.framework.apollo.util.ConfigUtil
;
import
com.google.common.base.Function
;
import
com.google.common.io.BaseEncoding
;
import
com.google.common.io.CharStreams
;
import
com.google.gson.Gson
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.lang.reflect.Type
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
/**
...
...
@@ -24,7 +20,6 @@ import java.nio.charset.StandardCharsets;
public
class
HttpUtil
{
private
ConfigUtil
m_configUtil
;
private
Gson
gson
;
private
String
basicAuth
;
/**
* Constructor.
...
...
@@ -32,11 +27,6 @@ public class HttpUtil {
public
HttpUtil
()
{
m_configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
gson
=
new
Gson
();
try
{
basicAuth
=
"Basic "
+
BaseEncoding
.
base64
().
encode
(
"user:"
.
getBytes
(
"UTF-8"
));
}
catch
(
UnsupportedEncodingException
ex
)
{
ex
.
printStackTrace
();
}
}
/**
...
...
@@ -85,7 +75,6 @@ public class HttpUtil {
HttpURLConnection
conn
=
(
HttpURLConnection
)
new
URL
(
httpRequest
.
getUrl
()).
openConnection
();
conn
.
setRequestMethod
(
"GET"
);
conn
.
setRequestProperty
(
"Authorization"
,
basicAuth
);
int
connectTimeout
=
httpRequest
.
getConnectTimeout
();
if
(
connectTimeout
<
0
)
{
...
...
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/TestWebSecurityConfig.java
浏览文件 @
bf496b4f
package
com.ctrip.framework.apollo.configservice.controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
...
...
@@ -20,10 +18,4 @@ public class TestWebSecurityConfig extends WebSecurityConfigurerAdapter {
http
.
headers
().
frameOptions
().
disable
();
}
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
inMemoryAuthentication
().
withUser
(
"user"
).
password
(
""
).
roles
(
"USER"
);
auth
.
inMemoryAuthentication
().
withUser
(
"apollo"
).
password
(
""
).
roles
(
"USER"
,
"ADMIN"
);
}
}
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/AbstractBaseIntegrationTest.java
浏览文件 @
bf496b4f
...
...
@@ -46,7 +46,7 @@ public abstract class AbstractBaseIntegrationTest {
private
Gson
gson
=
new
Gson
();
RestTemplate
restTemplate
=
new
TestRestTemplate
(
"user"
,
""
);
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@PostConstruct
private
void
postConstruct
()
{
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/AbstractIntegrationTest.java
浏览文件 @
bf496b4f
...
...
@@ -17,7 +17,7 @@ import javax.annotation.PostConstruct;
@WebIntegrationTest
(
randomPort
=
true
)
public
abstract
class
AbstractIntegrationTest
{
RestTemplate
restTemplate
=
new
TestRestTemplate
(
"apollo"
,
""
);
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@PostConstruct
private
void
postConstruct
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录