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 78503 Details for
Bug 200634
make "Save Password" to keyring optional, similar to Team/CVS approach
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]
Patch
patch200634.txt (text/plain), 16.24 KB, created by
Frank Becker
on 2007-09-15 16:00:40 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2007-09-15 16:00:40 EDT
Size:
16.24 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java,v >retrieving revision 1.141 >diff -u -r1.141 TasksUiPlugin.java >--- src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java 12 Sep 2007 03:52:30 -0000 1.141 >+++ src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java 15 Sep 2007 19:30:04 -0000 >@@ -34,6 +34,7 @@ > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; >+import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.WizardDialog; > import org.eclipse.mylyn.context.core.ContextCorePlugin; > import org.eclipse.mylyn.internal.context.core.ContextPreferenceContstants; >@@ -41,6 +42,7 @@ > import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer; > import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager; > import org.eclipse.mylyn.internal.tasks.core.TaskDataManager; >+import org.eclipse.mylyn.internal.tasks.ui.EnterMemoryPassordDialog; > import org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor; > import org.eclipse.mylyn.internal.tasks.ui.ITaskHighlighter; > import org.eclipse.mylyn.internal.tasks.ui.ITaskListNotification; >@@ -1046,4 +1048,18 @@ > } > } > >+ public static void testAndSetMemoryOnlyPassword(TaskRepository repository) { >+ boolean bb = repository.isMemoryOnlyPassword() && repository.getCachedPassword().compareTo("")== 0; >+ if (bb) { >+ EnterMemoryPassordDialog dialog = new EnterMemoryPassordDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), repository); >+ int result = dialog.open(); >+ if (result == Window.OK) { >+ String password = dialog.getPassword();; >+ if (password == null) >+ password = ""; >+ repository.setCachedPassword(password); >+ } >+ } >+ >+ } > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java,v >retrieving revision 1.20 >diff -u -r1.20 EditRepositoryWizard.java >--- src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java 26 Jun 2007 01:16:40 -0000 1.20 >+++ src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java 15 Sep 2007 19:29:57 -0000 >@@ -59,6 +59,8 @@ > repository.setAuthenticationCredentials(abstractRepositorySettingsPage.getUserName(), > abstractRepositorySettingsPage.getPassword()); > repository.setRepositoryLabel(abstractRepositorySettingsPage.getRepositoryLabel()); >+ repository.setMemoryOnlyPassword(abstractRepositorySettingsPage.getMemoryonlyPassword()); >+ > repository.setAnonymous(abstractRepositorySettingsPage.isAnonymousAccess()); > repository.setHttpAuthenticationCredentials(abstractRepositorySettingsPage.getHttpAuthUserId(), > abstractRepositorySettingsPage.getHttpAuthPassword()); >Index: src/org/eclipse/mylyn/internal/tasks/ui/ScheduledTaskListSynchJob.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduledTaskListSynchJob.java,v >retrieving revision 1.26 >diff -u -r1.26 ScheduledTaskListSynchJob.java >--- src/org/eclipse/mylyn/internal/tasks/ui/ScheduledTaskListSynchJob.java 6 Sep 2007 03:19:29 -0000 1.26 >+++ src/org/eclipse/mylyn/internal/tasks/ui/ScheduledTaskListSynchJob.java 15 Sep 2007 19:29:56 -0000 >@@ -55,6 +55,14 @@ > this.taskListManager = taskListManager; > this.setSystem(true); > this.setPriority(Job.BUILD); >+ >+ if (repositories == null) { >+ repositories = TasksUiPlugin.getRepositoryManager().getAllRepositories(); >+ } >+ >+ for (final TaskRepository repository : repositories) { >+ TasksUiPlugin.testAndSetMemoryOnlyPassword(repository); >+ } > } > > public ScheduledTaskListSynchJob(TaskListManager taskListManager) { >@@ -62,10 +70,19 @@ > this.taskListManager = taskListManager; > this.setPriority(Job.BUILD); > this.scheduleDelay = -1; >+ >+ if (repositories == null) { >+ repositories = TasksUiPlugin.getRepositoryManager().getAllRepositories(); >+ } >+ >+ for (final TaskRepository repository : repositories) { >+ TasksUiPlugin.testAndSetMemoryOnlyPassword(repository); >+ } > } > > @Override > public IStatus run(final IProgressMonitor monitor) { >+ > try { > taskList = taskListManager.getTaskList(); > if (repositories == null) { >@@ -83,6 +100,7 @@ > continue; > } > >+ > final AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() > .getRepositoryConnector(repository.getConnectorKind()); > if (connector == null) { >Index: src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java,v >retrieving revision 1.32 >diff -u -r1.32 AbstractRepositorySettingsPage.java >--- src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java 11 Sep 2007 22:26:52 -0000 1.32 >+++ src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java 15 Sep 2007 19:30:07 -0000 >@@ -188,6 +188,9 @@ > > private Hyperlink manageAccountHyperlink; > >+ protected Button memoryonlyPasswordButton; >+ >+ > public AbstractRepositorySettingsPage(String title, String description, AbstractRepositoryConnectorUi repositoryUi) { > super(title); > super.setTitle(title); >@@ -318,6 +321,18 @@ > }); > } > >+ memoryonlyPasswordButton = new Button(compositeContainer, SWT.CHECK); >+ GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(memoryonlyPasswordButton); >+ >+ memoryonlyPasswordButton.setText("Memoryonly Password"); >+ memoryonlyPasswordButton.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ setMemoryOnly(memoryonlyPasswordButton.getSelection()); >+ isPageComplete(); >+ } >+ }); >+ > repositoryUserNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, > compositeContainer) { > >@@ -377,6 +392,8 @@ > setAnonymous(true); > } > } >+ >+ memoryonlyPasswordButton.setSelection(repository.isMemoryOnlyPassword()); > > // TODO: put this back if we can't get the info from all connectors > // if (needsTimeZone()) { >@@ -832,6 +849,23 @@ > } > } > >+ public void setMemoryOnly(boolean selected) { >+ >+ memoryonlyPasswordButton.setSelection(selected); >+ >+ if (selected) { >+ oldPassword = (repositoryPasswordEditor).getStringValue(); >+ repositoryPasswordEditor.setStringValue(""); >+ } else { >+ repositoryPasswordEditor.setStringValue(oldPassword); >+ } >+ >+ repositoryPasswordEditor.setEnabled(!selected, compositeContainer); >+ if (getWizard() != null) { >+ getWizard().getContainer().updateButtons(); >+ } >+ } >+ > public void setHttpAuth(boolean selected) { > if (!needsHttpAuth) { > return; >@@ -1042,9 +1076,9 @@ > > private String credentialsComplete() { > if ((needsAnonymousLogin() && !anonymousButton.getSelection()) >- && (repositoryUserNameEditor.getStringValue().trim().equals("") || repositoryPasswordEditor.getStringValue() >+ && (repositoryUserNameEditor.getStringValue().trim().equals("") || (repositoryPasswordEditor.getStringValue() > .trim() >- .equals(""))) { >+ .equals("")) ) && !memoryonlyPasswordButton.getSelection()) { > return "Repository user name and password must not be blank"; > } > return null; >@@ -1122,6 +1156,7 @@ > if (needsAnonymousLogin()) { > repository.setAnonymous(anonymousButton.getSelection()); > } >+ repository.setMemoryOnlyPassword(memoryonlyPasswordButton.getSelection()); > // repository.setProperty(TaskRepository.AUTH_HTTP_USERNAME, > // getHttpAuthUserId()); > // repository.setProperty(TaskRepository.AUTH_HTTP_PASSWORD, >@@ -1314,4 +1349,8 @@ > > } > >+ public Boolean getMemoryonlyPassword() { >+ return memoryonlyPasswordButton.getSelection(); >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/EnterMemoryPassordDialog.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/ui/EnterMemoryPassordDialog.java >diff -N src/org/eclipse/mylyn/internal/tasks/ui/EnterMemoryPassordDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/ui/EnterMemoryPassordDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,174 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers 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 >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.tasks.ui; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.VerifyEvent; >+import org.eclipse.swt.events.VerifyListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Text; >+ >+/** >+ * This Dialog is used to enter a memory only Password for TaskRepositories. >+ * >+ * @author Frank Becker >+ * @since 2.1 >+ */ >+ >+public class EnterMemoryPassordDialog extends Dialog { >+ >+ TaskRepository repository; >+ >+ Text passwordText; >+ >+ String password = ""; >+ >+ boolean inUpdate = false; >+ >+ List<Integer> numXs = new ArrayList<Integer>();; >+ >+ public EnterMemoryPassordDialog(Shell parentShell, TaskRepository repository) { >+ super(parentShell); >+ this.repository = repository; >+ } >+ >+ protected void configureShell(Shell newShell) { >+ super.configureShell(newShell); >+ newShell.setText("EnterMemoryPassordDialog Titel"); >+ } >+ >+ public String getPassword() { >+ return password; >+ } >+ >+ @Override >+ protected Control createContents(Composite parent) { >+ Composite main = new Composite(parent, SWT.NONE); >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 3; >+ main.setLayout(layout); >+ main.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ Label l = new Label(main, SWT.NULL); >+ l.setText("Please enter the Password for repository"); >+ >+ GridData gd = new GridData(); >+ gd.horizontalSpan = 3; >+ l.setLayoutData(gd); >+ >+ l = new Label(main, SWT.NULL); >+ >+ l.setText(repository.getRepositoryLabel()); >+ gd = new GridData(); >+ gd.horizontalSpan = 3; >+ l.setLayoutData(gd); >+ >+ passwordText = new Text(main, SWT.SINGLE | SWT.BORDER); >+ GridData data = new GridData(); >+ data.widthHint = 250; >+ data.horizontalSpan = 3; >+ passwordText.setLayoutData(data); >+ >+ passwordText.addVerifyListener(new VerifyListener() { >+ public void verifyText(VerifyEvent e) { >+ if (inUpdate) >+ return; >+ e.doit = false; >+ inUpdate = true; >+ switch (e.character) { >+ case 8: { >+ // backspace pressed >+ if (password.length() > 0) { >+ password = password.substring(0, password.length() - 1); >+ } >+ // get rid of bogus Xs >+ int numX = numXs.get(numXs.size() - 1).intValue(); >+ numXs.remove(numXs.size() - 1); >+ String oldText = passwordText.getText(); >+ String newText = oldText.substring(0, oldText.length() - numX); >+ passwordText.setText(newText); >+ passwordText.setSelection(newText.length()); >+ break; >+ } >+ default: { >+ String oldText = passwordText.getText(); >+ String x = getXs(); >+ numXs.add(numXs.size(), new Integer(x.length())); >+ String newText = oldText + x; >+ passwordText.setText(newText); >+ passwordText.setSelection(newText.length()); >+ password += e.character; >+ } >+ } >+ inUpdate = false; >+ } >+ }); >+ >+ Composite buttonComposite = new Composite(main, SWT.NONE); >+ >+ layout = new GridLayout(); >+ layout.numColumns = 2; >+ buttonComposite.setLayout(layout); >+ main.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ >+ Button b = new Button(buttonComposite, SWT.PUSH); >+ b.setText("QK"); >+ data = new GridData(); >+ data.widthHint = 70; >+ b.setLayoutData(data); >+ b.addListener(SWT.Selection, new Listener() { >+ public void handleEvent(Event event) { >+ okPressed(); >+ } >+ }); >+ buttonComposite.getShell().setDefaultButton(b); >+ b = new Button(buttonComposite, SWT.PUSH); >+ b.setText("Cancel"); >+ data = new GridData(); >+ data.widthHint = 70; >+ b.setLayoutData(data); >+ b.addListener(SWT.Selection, new Listener() { >+ public void handleEvent(Event event) { >+ cancelPressed(); >+ } >+ }); >+ Dialog.applyDialogFont(parent); >+ return main; >+ } >+ >+ String getXs() { >+ double random = Math.random(); >+ random *= 2; >+ random += 2; >+ long num = Math.round(random); >+ // Random number between 2 and 4 >+ switch ((int) num) { >+ case 2: >+ return "**"; //$NON-NLS-1$ >+ case 3: >+ return "***"; //$NON-NLS-1$ >+ case 4: >+ return "****"; //$NON-NLS-1$ >+ } >+ return "*"; //$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.40 >diff -u -r1.40 TaskRepository.java >--- src/org/eclipse/mylyn/tasks/core/TaskRepository.java 12 Sep 2007 17:16:53 -0000 1.40 >+++ src/org/eclipse/mylyn/tasks/core/TaskRepository.java 15 Sep 2007 19:30:09 -0000 >@@ -73,6 +73,8 @@ > > public static final String OFFLINE = "org.eclipse.mylyn.tasklist.repositories.offline"; > >+ public static final String MEMORYONLY_PASSWORD = "org.eclipse.mylyn.tasklist.repositories.memoryonly.password"; >+ > // HACK: Lock used to work around race condition in > // Platform.add/get/flushAuthorizationInfo() > private static final Object LOCK = new Object(); >@@ -83,6 +85,10 @@ > private boolean isCachedUserName; > > private String cachedUserName; >+ >+ private boolean isCachedUserPassword; >+ >+ private String cachedUserPassword; > > static { > URL url = null; >@@ -169,6 +175,19 @@ > } > > public String getPassword() { >+ if (!isCachedUserPassword) { >+ if (isMemoryOnlyPassword()) { >+ StatusHandler.log("Memoryonly Password not set for repository "+ this.getRepositoryLabel(), this); >+ cachedUserPassword = ""; >+ } else { >+ cachedUserPassword = getUserPasswordFromKeyRing(); >+ isCachedUserPassword = true; >+ } >+ } >+ return cachedUserPassword; >+ } >+ >+ private String getUserPasswordFromKeyRing() { > return getAuthInfo(AUTH_PASSWORD); > } > >@@ -192,6 +211,8 @@ > setCredentials(username, password, AUTH_USERNAME, AUTH_PASSWORD); > cachedUserName = username; > isCachedUserName = true; >+ cachedUserPassword = password; >+ isCachedUserPassword = true; > } > > public void setProxyAuthenticationCredentials(String username, String password) { >@@ -231,6 +252,7 @@ > headlessCreds.clear(); > } > isCachedUserName = false; >+ isCachedUserPassword = false; > } catch (CoreException e) { > StatusHandler.fail(e, "could not flush authorization credentials", true); > } >@@ -467,4 +489,27 @@ > return getProperty(OFFLINE) != null && "true".equals(getProperty(OFFLINE)); > } > >+ public void setCachedPassword(String cachedUserPassword) { >+ this.cachedUserPassword = cachedUserPassword; >+ isCachedUserPassword = true; >+ } >+ >+ public String getCachedPassword() { >+ if (isCachedUserPassword) >+ return cachedUserPassword; >+ else >+ return ""; >+ } >+ >+ public void setMemoryOnlyPassword(boolean b) { >+ properties.put(MEMORYONLY_PASSWORD, String.valueOf(b)); >+// if (b) >+// setAuthenticationCredentials(getUserName(), ""); >+ } >+ >+ public boolean isMemoryOnlyPassword() { >+ return /*getProperty(MEMORYONLY_PASSWORD) == null ||*/ "true".equals(getProperty(MEMORYONLY_PASSWORD)); >+ } >+ >+ > }
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 200634
:
78041
| 78503 |
78504
|
78816
|
78817
|
80187
|
80288
|
80289
|
80290
|
80305
|
80306
|
80829
|
80830
|
80840
|
80841
|
81025
|
81212