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 167670 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
[patch]
Migration process support
patch.txt (text/plain), 10.88 KB, created by
Pawel Niewiadomski
on 2010-05-10 05:22:22 EDT
(
hide
)
Description:
Migration process support
Filename:
MIME Type:
Creator:
Pawel Niewiadomski
Created:
2010-05-10 05:22:22 EDT
Size:
10.88 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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 10 May 2010 09:21:49 -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 10 May 2010 09:21:49 -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 10 May 2010 09:21:50 -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 10 May 2010 09:21:50 -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 10 May 2010 09:21:50 -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,86 @@ >+/******************************************************************************* >+ * 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.Map; >+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.equinox.security.storage.EncodingUtils; >+import org.eclipse.equinox.security.storage.ISecurePreferences; >+import org.eclipse.equinox.security.storage.SecurePreferencesFactory; >+import org.eclipse.mylyn.commons.core.StatusHandler; >+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", "unchecked" }) >+ public static boolean migrateToSecureStorage(TaskRepository repository) { >+ if (repository.getProperty(ITasksCoreConstants.PROPERTY_USE_SECURE_STORAGE) == null >+ && !repository.getUrl().equals("local")) { //$NON-NLS-1$ >+ try { >+ Map<String, String> map = Platform.getAuthorizationInfo(new URL(repository.getUrl()), "", "Basic");//$NON-NLS-1$ //$NON-NLS-2$ >+ if (map != null) { >+ ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault().node( >+ ITasksCoreConstants.ID_PLUGIN); >+ securePreferences = securePreferences.node(EncodingUtils.encodeSlashes(repository.getUrl())); >+ for (String key : map.keySet()) { >+ String value = map.get(key); >+ if (value != null) { >+ securePreferences.put(key, value, key.endsWith(".password")); //$NON-NLS-1$ >+ } >+ } >+ 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.setProperty(ITasksCoreConstants.PROPERTY_USE_SECURE_STORAGE, "true"); //$NON-NLS-1$ >+ return true; >+ } catch (Exception e) { >+ StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, NLS.bind( >+ Messages.MigrateToSecureStorageJob_failed, repository.getUrl()), e)); >+ } >+ } >+ return false; >+ } >+} >#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 10 May 2010 09:21:51 -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$ >+ > }
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