Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2007-11-29 23:23:00 +0000
committerspingel2007-11-29 23:23:00 +0000
commitdcd25ecb79f261de3d92866e86a7cb1239a6a0de (patch)
treec20e6051bd6f7939adffd2682e105bc2aa19c379 /org.eclipse.mylyn.trac.core
parent82ec20c309f3bf55cb638e44b163037666d93877 (diff)
downloadorg.eclipse.mylyn.tasks-dcd25ecb79f261de3d92866e86a7cb1239a6a0de.tar.gz
org.eclipse.mylyn.tasks-dcd25ecb79f261de3d92866e86a7cb1239a6a0de.tar.xz
org.eclipse.mylyn.tasks-dcd25ecb79f261de3d92866e86a7cb1239a6a0de.zip
NEW - bug 208935: [api] make TaskRepository authentication API extensible
https://bugs.eclipse.org/bugs/show_bug.cgi?id=208935
Diffstat (limited to 'org.eclipse.mylyn.trac.core')
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/AbstractTracClient.java6
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWebClient.java14
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracXmlRpcClient.java15
3 files changed, 18 insertions, 17 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/AbstractTracClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/AbstractTracClient.java
index 9a978726c..b5818f0e4 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/AbstractTracClient.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/AbstractTracClient.java
@@ -30,7 +30,7 @@ import org.eclipse.mylyn.internal.trac.core.model.TracTicketType;
import org.eclipse.mylyn.internal.trac.core.model.TracVersion;
import org.eclipse.mylyn.web.core.AbstractWebLocation;
import org.eclipse.mylyn.web.core.WebClientUtil;
-import org.eclipse.mylyn.web.core.WebCredentials;
+import org.eclipse.mylyn.web.core.AuthenticationCredentials;
/**
* @author Steffen Pingel
@@ -72,11 +72,11 @@ public abstract class AbstractTracClient implements ITracClient {
return version;
}
- protected boolean credentialsValid(WebCredentials credentials) {
+ protected boolean credentialsValid(AuthenticationCredentials credentials) {
return credentials != null && credentials.getUserName().length() > 0;
}
- protected void authenticateAccountManager(HttpClient httpClient, WebCredentials credentials) throws IOException, TracLoginException {
+ protected void authenticateAccountManager(HttpClient httpClient, AuthenticationCredentials credentials) throws IOException, TracLoginException {
PostMethod post = new PostMethod(WebClientUtil.getRequestPath(repositoryUrl + LOGIN_URL));
post.setFollowRedirects(false);
NameValuePair[] data = { new NameValuePair("referer", ""), new NameValuePair("user", credentials.getUserName()),
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWebClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWebClient.java
index fe906e38c..5fbdb5d0c 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWebClient.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWebClient.java
@@ -51,13 +51,13 @@ import org.eclipse.mylyn.internal.trac.core.util.TracUtils;
import org.eclipse.mylyn.internal.trac.core.util.TracHttpClientTransportFactory.TracHttpException;
import org.eclipse.mylyn.monitor.core.StatusHandler;
import org.eclipse.mylyn.web.core.AbstractWebLocation;
+import org.eclipse.mylyn.web.core.AuthenticationType;
import org.eclipse.mylyn.web.core.HtmlStreamTokenizer;
import org.eclipse.mylyn.web.core.HtmlTag;
import org.eclipse.mylyn.web.core.WebClientUtil;
-import org.eclipse.mylyn.web.core.WebCredentials;
+import org.eclipse.mylyn.web.core.AuthenticationCredentials;
import org.eclipse.mylyn.web.core.AbstractWebLocation.ResultType;
import org.eclipse.mylyn.web.core.HtmlStreamTokenizer.Token;
-import org.eclipse.mylyn.web.core.WebCredentials.Type;
/**
* Represents a Trac repository that is accessed through the Trac's query script and web interface.
@@ -99,7 +99,7 @@ public class TracWebClient extends AbstractTracClient {
for (int attempt = 0; attempt < 2; attempt++) {
// force authentication
if (!authenticated) {
- WebCredentials credentials = location.getCredentials(WebCredentials.Type.REPOSITORY);
+ AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY);
if (credentialsValid(credentials)) {
authenticate(monitor);
}
@@ -131,7 +131,7 @@ public class TracWebClient extends AbstractTracClient {
private void authenticate(IProgressMonitor monitor) throws TracLoginException, IOException {
while (true) {
- WebCredentials credentials = location.getCredentials(WebCredentials.Type.REPOSITORY);
+ AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY);
if (!credentialsValid(credentials)) {
throw new TracLoginException();
}
@@ -170,11 +170,11 @@ public class TracWebClient extends AbstractTracClient {
}
private boolean needsReauthentication(int code) throws IOException, TracLoginException {
- final Type authenticationType;
+ final AuthenticationType authenticationType;
if (code == HttpStatus.SC_UNAUTHORIZED || code == HttpStatus.SC_FORBIDDEN) {
- authenticationType = Type.REPOSITORY;
+ authenticationType = AuthenticationType.REPOSITORY;
} else if (code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
- authenticationType = Type.PROXY;
+ authenticationType = AuthenticationType.PROXY;
} else {
return false;
}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracXmlRpcClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracXmlRpcClient.java
index ec04de6eb..a92dcdf6b 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracXmlRpcClient.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracXmlRpcClient.java
@@ -52,8 +52,9 @@ import org.eclipse.mylyn.internal.trac.core.util.TracUtils;
import org.eclipse.mylyn.internal.trac.core.util.TracHttpClientTransportFactory.TracHttpException;
import org.eclipse.mylyn.monitor.core.StatusHandler;
import org.eclipse.mylyn.web.core.AbstractWebLocation;
+import org.eclipse.mylyn.web.core.AuthenticationType;
import org.eclipse.mylyn.web.core.WebClientUtil;
-import org.eclipse.mylyn.web.core.WebCredentials;
+import org.eclipse.mylyn.web.core.AuthenticationCredentials;
import org.eclipse.mylyn.web.core.AbstractWebLocation.ResultType;
/**
@@ -116,7 +117,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli
}
// update configuration with latest values
- WebCredentials credentials = location.getCredentials(WebCredentials.Type.REPOSITORY);
+ AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY);
if (credentialsValid(credentials)) {
config.setBasicUserName(credentials.getUserName());
config.setBasicPassword(credentials.getPassword());
@@ -129,7 +130,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli
return xmlrpc;
}
- private URL getXmlRpcUrl(WebCredentials credentials) throws TracException {
+ private URL getXmlRpcUrl(AuthenticationCredentials credentials) throws TracException {
try {
String location = repositoryUrl.toString();
if (credentialsValid(credentials)) {
@@ -150,15 +151,15 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli
try {
return executeCall(method, parameters);
} catch (TracLoginException e) {
- if (location.requestCredentials(WebCredentials.Type.REPOSITORY, null) == ResultType.NOT_SUPPORTED) {
+ if (location.requestCredentials(AuthenticationType.REPOSITORY, null) == ResultType.NOT_SUPPORTED) {
throw e;
}
} catch (TracPermissionDeniedException e) {
- if (location.requestCredentials(WebCredentials.Type.REPOSITORY, null) == ResultType.NOT_SUPPORTED) {
+ if (location.requestCredentials(AuthenticationType.REPOSITORY, null) == ResultType.NOT_SUPPORTED) {
throw e;
}
} catch (TracProxyAuthenticationException e) {
- if (location.requestCredentials(WebCredentials.Type.PROXY, null) == ResultType.NOT_SUPPORTED) {
+ if (location.requestCredentials(AuthenticationType.PROXY, null) == ResultType.NOT_SUPPORTED) {
throw e;
}
}
@@ -176,7 +177,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli
throw e;
}
- WebCredentials credentials = location.getCredentials(WebCredentials.Type.REPOSITORY);
+ AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY);
if (!credentialsValid(credentials)) {
throw e;
}

Back to the top