summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.6.1/modules
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-10-21 10:42:46 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-10-21 10:42:46 +0000
commite37855b362f7c5a5242b0a0466b13be806aed9ec (patch)
tree15d4563dbe2f06c6598125ddd28d8524e4ba1e4a /sca-java-1.x/branches/sca-java-1.6.1/modules
parent6a2fb5a2e3b6dca68075cf99be7bb0b00d39d018 (diff)
TUSCANY-3735: Don't use HTTP authorization or authentication by default
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1025934 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.6.1/modules')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java24
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java18
2 files changed, 29 insertions, 13 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java b/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
index 92ccf2c5c3..5982d77f94 100644
--- a/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
@@ -96,7 +96,9 @@ class AtomBindingInvoker implements Invoker, DataExchangeSemantics {
// Send an HTTP GET
GetMethod getMethod = new GetMethod(uri + "/" + id);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
+ if (authorizationHeader != null) {
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ }
boolean parsing = false;
try {
httpClient.executeMethod(getMethod);
@@ -173,7 +175,9 @@ class AtomBindingInvoker implements Invoker, DataExchangeSemantics {
// Send an HTTP POST
PostMethod postMethod = new PostMethod(uri);
- postMethod.setRequestHeader("Authorization", authorizationHeader);
+ if (authorizationHeader != null) {
+ postMethod.setRequestHeader("Authorization", authorizationHeader);
+ }
boolean parsing = false;
try {
@@ -259,7 +263,9 @@ class AtomBindingInvoker implements Invoker, DataExchangeSemantics {
// Send an HTTP PUT
PutMethod putMethod = new PutMethod(uri + "/" + id);
- putMethod.setRequestHeader("Authorization", authorizationHeader);
+ if (authorizationHeader != null) {
+ putMethod.setRequestHeader("Authorization", authorizationHeader);
+ }
try {
@@ -310,7 +316,9 @@ class AtomBindingInvoker implements Invoker, DataExchangeSemantics {
// Send an HTTP DELETE
DeleteMethod deleteMethod = new DeleteMethod(uri + "/" + id);
- deleteMethod.setRequestHeader("Authorization", authorizationHeader);
+ if (authorizationHeader != null) {
+ deleteMethod.setRequestHeader("Authorization", authorizationHeader);
+ }
try {
httpClient.executeMethod(deleteMethod);
int status = deleteMethod.getStatusCode();
@@ -351,7 +359,9 @@ class AtomBindingInvoker implements Invoker, DataExchangeSemantics {
// Send an HTTP GET
GetMethod getMethod = new GetMethod(uri);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
+ if (authorizationHeader != null) {
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ }
boolean parsing = false;
try {
httpClient.executeMethod(getMethod);
@@ -427,7 +437,9 @@ class AtomBindingInvoker implements Invoker, DataExchangeSemantics {
// Send an HTTP GET
GetMethod getMethod = new GetMethod(uri);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
+ if (authorizationHeader != null) {
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ }
getMethod.setQueryString(queryString);
boolean parsing = false;
try {
diff --git a/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java b/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java
index 65331af34c..1961146188 100644
--- a/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java
@@ -49,7 +49,7 @@ class AtomReferenceBindingProvider implements ReferenceBindingProvider {
private RuntimeComponentReference reference;
private AtomBinding binding;
- private String authorizationHeader;
+ private String authorizationHeader = null;
private HttpClient httpClient;
private Mediator mediator;
private DataType<?> itemClassType;
@@ -72,8 +72,10 @@ class AtomReferenceBindingProvider implements ReferenceBindingProvider {
this.mediator = mediator;
// Prepare authorization header
- String authorization = "admin" + ":" + "admin";
- authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes()));
+ // TUSCANY-3735: Don't send authorization header by default as this can cause problems.
+ // Commented out the following two lines until we have a better way to control this.
+ //String authorization = "admin" + ":" + "admin";
+ //authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes()));
// Create an HTTP client
HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
@@ -124,10 +126,12 @@ class AtomReferenceBindingProvider implements ReferenceBindingProvider {
public void start() {
// Configure the HTTP client credentials
- Credentials credentials = new UsernamePasswordCredentials("admin", "admin");
- httpClient.getParams().setAuthenticationPreemptive(true);
- URI uri = URI.create(binding.getURI());
- httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort()), credentials);
+ // TUSCANY-3735: Don't use authentication by default as this can cause problems.
+ // Commented out the following four lines until we have a better way to control this.
+ //Credentials credentials = new UsernamePasswordCredentials("admin", "admin");
+ //httpClient.getParams().setAuthenticationPreemptive(true);
+ //URI uri = URI.create(binding.getURI());
+ //httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort()), credentials);
// Find the get operation on the reference interface
if (true) {