Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oberlies2012-01-02 13:38:21 +0000
committerTobias Oberlies2012-01-12 16:39:32 +0000
commitb25110d66c3fee4132d6357c19e9858d0dd59790 (patch)
tree2b671f682ec11b6959a270a425bb0f6c364d50b9
parent648e4ba378e1e4c43edd151491bab3347817c69e (diff)
downloadrt.equinox.p2-b25110d66c3fee4132d6357c19e9858d0dd59790.tar.gz
rt.equinox.p2-b25110d66c3fee4132d6357c19e9858d0dd59790.tar.xz
rt.equinox.p2-b25110d66c3fee4132d6357c19e9858d0dd59790.zip
348366 Only remember cancel if dialog explicitly signals cancel
- Back-port of c56d308. Differences: The bundle versions are adapted according to the rules for the maintenance branch R37x. - Introduced a new constant in UIServices to give the implementations the possibility to explicitly indicate that the user cancelled a prompt for password. - Only remember cancel in class Credentials on explicit user cancels. This ensures that the authentication prompt is shown at least once. Bug: 348366 - [repository] Cannot update from update site with authentication
-rw-r--r--bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.core/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java12
7 files changed, 29 insertions, 13 deletions
diff --git a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
index dc3c9e274..8c12d4e5d 100644
--- a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.core;singleton:=true
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 2.1.1.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.equinox.internal.p2.core.Activator
Bundle-Vendor: %providerName
diff --git a/bundles/org.eclipse.equinox.p2.core/pom.xml b/bundles/org.eclipse.equinox.p2.core/pom.xml
index 1135dcf35..dce7190ba 100644
--- a/bundles/org.eclipse.equinox.p2.core/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.core/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse</groupId>
<artifactId>org.eclipse.equinox.p2.core</artifactId>
- <version>2.1.0.qualifier</version>
+ <version>2.1.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java
index 00d79e370..d0331862e 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,14 @@ public abstract class UIServices {
public static final String SERVICE_NAME = UIServices.class.getName();
/**
+ * This constant may be returned by the <code>getUsernamePassword</code> methods if the user
+ * explicitly canceled the authentication prompt.
+ *
+ * @since 2.1.1
+ */
+ public static final AuthenticationInfo AUTHENTICATION_PROMPT_CANCELED = new AuthenticationInfo("", "", false); //$NON-NLS-1$//$NON-NLS-2$
+
+ /**
* Authentication information returned from an authentication prompt request.
*/
public static class AuthenticationInfo {
@@ -109,7 +117,7 @@ public abstract class UIServices {
* Opens a UI prompt for authentication details
*
* @param location - the location requiring login details, may be <code>null</code>.
- * @return The authentication result
+ * @return The authentication result, or <code>null</code>, or {@link #AUTHENTICATION_PROMPT_CANCELED}
*/
public abstract AuthenticationInfo getUsernamePassword(String location);
@@ -119,7 +127,7 @@ public abstract class UIServices {
*
* @param location the location requiring login details
* @param previousInfo - the previously used authentication details - may not be null.
- * @return The authentication result
+ * @return The authentication result, or <code>null</code>, or {@link #AUTHENTICATION_PROMPT_CANCELED}
*/
public abstract AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo);
diff --git a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
index 692c9c6a7..ccb090fab 100644
--- a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.repository;singleton:=true
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 2.1.1.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.repository.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.equinox.p2.repository/pom.xml b/bundles/org.eclipse.equinox.p2.repository/pom.xml
index df8ce6caf..0425c6b96 100644
--- a/bundles/org.eclipse.equinox.p2.repository/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.repository/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse</groupId>
<artifactId>org.eclipse.equinox.p2.repository</artifactId>
- <version>2.1.0.qualifier</version>
+ <version>2.1.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
index 309757241..96cd71426 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2012 IBM Corporation and others.
* The code, documentation and other materials contained herein have been
* licensed under the Eclipse Public License - v 1.0 by the copyright holder
* listed above, as the Initial Contributor under such license. The text of
@@ -233,13 +233,15 @@ public class Credentials {
loginDetails = lastUsed != null ? adminUIService.getUsernamePassword(host, lastUsed) : adminUIService.getUsernamePassword(host);
//null result means user canceled password dialog
if (DebugHelper.DEBUG_REPOSITORY_CREDENTIALS) {
- if (loginDetails == null)
+ if (loginDetails == UIServices.AUTHENTICATION_PROMPT_CANCELED)
DebugHelper.debug("Credentials", "forLocation:PROMPTED - USER CANCELED (PROMPT LOCK RELEASED)", // //$NON-NLS-1$ //$NON-NLS-2$
new Object[] {"host", location}); //$NON-NLS-1$
}
- if (loginDetails == null) {
+ if (loginDetails == UIServices.AUTHENTICATION_PROMPT_CANCELED) {
rememberCancel(host);
throw new LoginCanceledException();
+ } else if (loginDetails == null) {
+ throw new LoginCanceledException();
}
//save user name and password if requested by user
if (DebugHelper.DEBUG_REPOSITORY_CREDENTIALS) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
index b731d0e33..ff6209f26 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -63,8 +63,11 @@ public class ValidationDialogServiceUI extends UIServices {
Shell shell = ProvUI.getDefaultParentShell();
String message = NLS.bind(ProvUIMessages.ServiceUI_LoginDetails, location);
UserValidationDialog dialog = new UserValidationDialog(shell, ProvUIMessages.ServiceUI_LoginRequired, null, message);
- if (dialog.open() == Window.OK) {
+ int dialogCode = dialog.open();
+ if (dialogCode == Window.OK) {
result[0] = dialog.getResult();
+ } else if (dialogCode == Window.CANCEL) {
+ result[0] = AUTHENTICATION_PROMPT_CANCELED;
}
}
@@ -170,8 +173,11 @@ public class ValidationDialogServiceUI extends UIServices {
message = NLS.bind(ProvUIMessages.ProvUIMessages_NotAccepted_EnterFor_0, location);
UserValidationDialog dialog = new UserValidationDialog(previousInfo, shell, ProvUIMessages.ServiceUI_LoginRequired, null, message);
- if (dialog.open() == Window.OK) {
+ int dialogCode = dialog.open();
+ if (dialogCode == Window.OK) {
result[0] = dialog.getResult();
+ } else if (dialogCode == Window.CANCEL) {
+ result[0] = AUTHENTICATION_PROMPT_CANCELED;
}
}

Back to the top