Package: eclipse-mylyn / 3.12.0-1

bugzilla-http-authentication.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From: Jakub Adam <jakub.adam@ktknet.cz>
Date: Mon, 14 Oct 2013 19:15:19 +0200
Subject: bugzilla-http-authentication

---
 .../org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java | 4 +++-
 .../internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java      | 9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
index 06647e6..0770dfd 100644
--- a/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
+++ b/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
@@ -466,7 +466,9 @@ public class BugzillaClient {
 				throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
 						RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(),
 						"Proxy authentication required")); //$NON-NLS-1$
-
+			} else if (code == HttpURLConnection.HTTP_MOVED_TEMP && credentials == null) {
+				// With only HTTP authentication, getting 302 basically means success
+				loggedIn = true;
 			} else if (code != HttpURLConnection.HTTP_OK) {
 				loggedIn = false;
 				WebUtil.releaseConnection(postMethod, monitor);
diff --git a/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
index b5f2711..590d9ef 100644
--- a/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
+++ b/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
@@ -27,6 +27,8 @@ import org.eclipse.jface.fieldassist.ControlDecoration;
 import org.eclipse.jface.fieldassist.FieldDecoration;
 import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
 import org.eclipse.mylyn.commons.core.StatusHandler;
+import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
+import org.eclipse.mylyn.commons.net.AuthenticationType;
 import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
 import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
 import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
@@ -605,7 +607,12 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
 	private boolean checkCanSubmit(final int type) {
 		final TaskRepository taskRepository = getModel().getTaskRepository();
 		String username = taskRepository.getUserName();
-		if (username == null || username.length() == 0) {
+		String httpUsername = null;
+		AuthenticationCredentials httpCredentials = taskRepository.getCredentials(AuthenticationType.HTTP);
+		if (httpCredentials != null) {
+			httpUsername = httpCredentials.getPassword();
+		}
+		if ((username == null || username.length() == 0) && (httpUsername == null || httpUsername.length() == 0)) {
 			PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
 				public void run() {
 					getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Anonymous_can_not_submit_Tasks, type,