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
0f03174c
Commit
0f03174c
authored
Oct 09, 2017
by
nobodyiam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove useless authentication codes
parent
2650b3c0
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
43 deletions
+20
-43
AbstractControllerTest.java
...pollo/adminservice/controller/AbstractControllerTest.java
+1
-1
ItemSetControllerTest.java
...apollo/adminservice/controller/ItemSetControllerTest.java
+5
-5
TestWebSecurityConfig.java
...apollo/adminservice/controller/TestWebSecurityConfig.java
+0
-11
WebSecurityConfig.java
...om/ctrip/framework/apollo/biz/auth/WebSecurityConfig.java
+7
-0
HttpUtil.java
...n/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
+5
-16
TestWebSecurityConfig.java
...pollo/configservice/controller/TestWebSecurityConfig.java
+0
-8
AbstractBaseIntegrationTest.java
...onfigservice/integration/AbstractBaseIntegrationTest.java
+1
-1
AbstractIntegrationTest.java
...trip/framework/apollo/portal/AbstractIntegrationTest.java
+1
-1
No files found.
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java
View file @
0f03174c
...
...
@@ -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
View file @
0f03174c
...
...
@@ -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
View file @
0f03174c
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
View file @
0f03174c
...
...
@@ -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
View file @
0f03174c
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
View file @
0f03174c
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
View file @
0f03174c
...
...
@@ -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
View file @
0f03174c
...
...
@@ -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
()
{
...
...
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