Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 168720 Details for
Bug 278474
perform migration of credentials to secure storage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Version 3
clipboard.txt (text/plain), 11.59 KB, created by
Pawel Niewiadomski
on 2010-05-17 08:56:27 EDT
(
hide
)
Description:
Version 3
Filename:
MIME Type:
Creator:
Pawel Niewiadomski
Created:
2010-05-17 08:56:27 EDT
Size:
11.59 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java,v >retrieving revision 1.82 >diff -u -r1.82 IBugzillaConstants.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 1 Sep 2009 04:13:59 -0000 1.82 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 17 May 2010 12:54:26 -0000 >@@ -160,7 +160,6 @@ > > static final String VALUES_TARGET = "org.eclipse.mylyn.bugzilla.values.target"; //$NON-NLS-1$ > >- > // Default values for keys > > static final String[] DEFAULT_STATUS_VALUES = { "Unconfirmed", "New", "Assigned", "Reopened", "Resolved", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$ >@@ -272,4 +271,6 @@ > > public static final String LAST_COMPONENT_SELECTION = "last.selection.component"; //$NON-NLS-1$ > >+ public static final String PREFERENCE_SECURE_STORAGE_MIGRATED = "secure_storage.migration.done"; //$NON-NLS-1$ >+ > } >#P org.eclipse.mylyn.tasks.core >Index: src/org/eclipse/mylyn/tasks/core/TaskRepository.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java,v >retrieving revision 1.90 >diff -u -r1.90 TaskRepository.java >--- src/org/eclipse/mylyn/tasks/core/TaskRepository.java 4 Mar 2010 18:41:21 -0000 1.90 >+++ src/org/eclipse/mylyn/tasks/core/TaskRepository.java 17 May 2010 12:54:27 -0000 >@@ -650,8 +650,25 @@ > * Legacy support for < 2.2. Remove in 2.3. > */ > private String getUserName(AuthenticationType authType) { >- AuthenticationCredentials credentials = getCredentials(authType); >- return (credentials != null) ? credentials.getUserName() : null; >+ String key = getKeyPrefix(authType); >+ >+ String enabled = getProperty(key + ENABLED); >+ if (enabled == null || "true".equals(enabled)) { //$NON-NLS-1$ >+ String userName = getAuthInfo(key + USERNAME); >+ >+ if (userName == null) { >+ userName = ""; //$NON-NLS-1$ >+ } >+ >+ if (enabled == null && userName.length() == 0) { >+ // API30: legacy support for versions prior to 2.2 that did not set the enable flag, remove for 3.0 >+ return null; >+ } >+ >+ return userName; >+ } else { >+ return null; >+ } > } > > public String getVersion() { >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java,v >retrieving revision 1.61 >diff -u -r1.61 BugzillaUiPlugin.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java 2 Oct 2009 20:24:49 -0000 1.61 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java 17 May 2010 12:54:28 -0000 >@@ -14,12 +14,16 @@ > import java.util.ArrayList; > import java.util.List; > >+import org.eclipse.core.runtime.jobs.IJobChangeEvent; >+import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.core.runtime.jobs.JobChangeAdapter; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector; > import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; > import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; >+import org.eclipse.mylyn.tasks.ui.MigrateToSecureStorageJob; > import org.eclipse.mylyn.tasks.ui.TasksUi; > import org.eclipse.ui.plugin.AbstractUIPlugin; > import org.osgi.framework.BundleContext; >@@ -91,6 +95,18 @@ > > TasksUi.getRepositoryManager().addListener(bugzillaConnector.getClientManager()); > >+ if (!getPreferenceStore().getBoolean(IBugzillaConstants.PREFERENCE_SECURE_STORAGE_MIGRATED)) { >+ Job migrateJob = new MigrateToSecureStorageJob(BugzillaCorePlugin.CONNECTOR_KIND); >+ migrateJob.addJobChangeListener(new JobChangeAdapter() { >+ @Override >+ public void done(IJobChangeEvent event) { >+ super.done(event); >+ getPreferenceStore().setValue(IBugzillaConstants.PREFERENCE_SECURE_STORAGE_MIGRATED, Boolean.TRUE); >+ } >+ }); >+ migrateJob.schedule(); >+ } >+ > // NOTE: initializing extensions in start(..) has caused race > // conditions previously > BugzillaUiExtensionReader.initStartupExtensions(); >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java,v >retrieving revision 1.98 >diff -u -r1.98 BugzillaRepositorySettingsPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java 8 Feb 2010 04:00:26 -0000 1.98 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java 17 May 2010 12:54:28 -0000 >@@ -35,6 +35,7 @@ > import org.eclipse.mylyn.tasks.core.RepositoryStatus; > import org.eclipse.mylyn.tasks.core.RepositoryTemplate; > import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.ui.MigrateToSecureStorageJob; > import org.eclipse.mylyn.tasks.ui.TasksUi; > import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage; > import org.eclipse.swt.SWT; >@@ -267,6 +268,8 @@ > > @Override > public void applyTo(TaskRepository repository) { >+ MigrateToSecureStorageJob.migrateToSecureStorage(repository); >+ > super.applyTo(repository); > repository.setProperty(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN, > String.valueOf(cleanQAContact.getSelection())); >#P org.eclipse.mylyn.tasks.ui >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.415 >diff -u -r1.415 MANIFEST.MF >--- META-INF/MANIFEST.MF 7 Apr 2010 20:54:55 -0000 1.415 >+++ META-INF/MANIFEST.MF 17 May 2010 12:54:29 -0000 >@@ -10,6 +10,7 @@ > org.eclipse.core.expressions, > org.eclipse.core.net, > org.eclipse.core.resources, >+ org.eclipse.equinox.security, > org.eclipse.jface.text, > org.eclipse.ui.browser, > org.eclipse.ui.editors, >Index: src/org/eclipse/mylyn/internal/tasks/ui/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties,v >retrieving revision 1.17 >diff -u -r1.17 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/messages.properties 10 Apr 2010 10:34:56 -0000 1.17 >+++ src/org/eclipse/mylyn/internal/tasks/ui/messages.properties 17 May 2010 12:54:30 -0000 >@@ -84,3 +84,6 @@ > TaskHyperlink_Open_Task_X_in_X=Open Task {0} in {1} > > AbstractRetrieveTitleFromUrlJob_Retrieving_summary_from_URL=Retrieving summary from URL >+ >+MigrateToSecureStorageJob_failed=Could not migrate credentials to secure storage for {0} >+MigrateToSecureStorageJob_title=Migrating passwords to secure storage >Index: src/org/eclipse/mylyn/internal/tasks/ui/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java,v >retrieving revision 1.12 >diff -u -r1.12 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/Messages.java 10 Apr 2010 10:34:56 -0000 1.12 >+++ src/org/eclipse/mylyn/internal/tasks/ui/Messages.java 17 May 2010 12:54:30 -0000 >@@ -25,6 +25,10 @@ > NLS.initializeMessages(BUNDLE_NAME, Messages.class); > } > >+ public static String MigrateToSecureStorageJob_failed; >+ >+ public static String MigrateToSecureStorageJob_title; >+ > public static String ActiveContextExternalizationParticipant_Active_Task_Context; > > public static String ActivityExternalizationParticipant_Activity_Context; >Index: src/org/eclipse/mylyn/tasks/ui/MigrateToSecureStorageJob.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/ui/MigrateToSecureStorageJob.java >diff -N src/org/eclipse/mylyn/tasks/ui/MigrateToSecureStorageJob.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/ui/MigrateToSecureStorageJob.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,81 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Tasktop Technologies 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.tasks.ui; >+ >+import java.net.MalformedURLException; >+import java.net.URL; >+import java.util.Set; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.jobs.Job; >+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.internal.tasks.core.ITasksCoreConstants; >+import org.eclipse.mylyn.internal.tasks.ui.Messages; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.osgi.util.NLS; >+ >+public class MigrateToSecureStorageJob extends Job { >+ >+ private final String kind; >+ >+ public MigrateToSecureStorageJob(String kind) { >+ super(Messages.MigrateToSecureStorageJob_title); >+ this.kind = kind; >+ } >+ >+ @Override >+ protected IStatus run(IProgressMonitor monitor) { >+ Set<TaskRepository> repos = TasksUiPlugin.getRepositoryManager().getRepositories(kind); >+ if (repos != null) { >+ for (TaskRepository repo : repos) { >+ migrateToSecureStorage(repo); >+ } >+ } >+ return Status.OK_STATUS; >+ } >+ >+ @SuppressWarnings({ "deprecation" }) >+ public static boolean migrateToSecureStorage(TaskRepository repository) { >+ if (repository.getProperty(ITasksCoreConstants.PROPERTY_USE_SECURE_STORAGE) == null >+ && !repository.getUrl().equals("local")) { //$NON-NLS-1$ >+ try { >+ AuthenticationCredentials creds = repository.getCredentials(AuthenticationType.REPOSITORY); >+ boolean savePassword = repository.getSavePassword(AuthenticationType.REPOSITORY); >+ >+ repository.setProperty(ITasksCoreConstants.PROPERTY_USE_SECURE_STORAGE, "true"); //$NON-NLS-1$ >+ >+ if (creds != null) { >+ try { >+ Platform.flushAuthorizationInfo(new URL(repository.getUrl()), "", "Basic"); //$NON-NLS-1$ //$NON-NLS-2$ >+ } catch (MalformedURLException ex) { >+ Platform.flushAuthorizationInfo( >+ new URL("http://eclipse.org/mylyn"), repository.getUrl(), "Basic"); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ repository.setCredentials(AuthenticationType.REPOSITORY, creds, savePassword); >+ } >+ >+ return true; >+ } catch (Exception e) { >+ StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, NLS.bind( >+ "Could not migrate credentials to secure storage for {0}", repository.getUrl()), e)); >+ } >+ } >+ return false; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 278474
:
167670
|
167937
|
168720
|
168895
|
240117