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 99377 Details for
Bug 230242
[sec] Add hints describing capabilities of the password providers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch I - non API changes
patch secure storage Hint.txt (text/plain), 13.46 KB, created by
Oleg Besedin
on 2008-05-08 16:49:10 EDT
(
hide
)
Description:
Patch I - non API changes
Filename:
MIME Type:
Creator:
Oleg Besedin
Created:
2008-05-08 16:49:10 EDT
Size:
13.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.security.win32.x86 >Index: fragment.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.win32.x86/fragment.xml,v >retrieving revision 1.2 >diff -u -r1.2 fragment.xml >--- fragment.xml 25 Apr 2008 17:53:59 -0000 1.2 >+++ fragment.xml 8 May 2008 20:45:00 -0000 >@@ -8,6 +8,9 @@ > <provider > class="org.eclipse.equinox.internal.security.win32.WinCrypto" > priority="5"> >+ <hint >+ value="AutomaticPasswordGeneration"> >+ </hint> > </provider> > </extension> > >#P org.eclipse.equinox.security.macosx >Index: fragment.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.macosx/fragment.xml,v >retrieving revision 1.2 >diff -u -r1.2 fragment.xml >--- fragment.xml 25 Apr 2008 17:53:55 -0000 1.2 >+++ fragment.xml 8 May 2008 20:45:01 -0000 >@@ -8,6 +8,9 @@ > <provider > class="org.eclipse.equinox.internal.security.osx.OSXProvider" > priority="5"> >+ <hint >+ value="AutomaticPasswordGeneration"> >+ </hint> > </provider> > </extension> > </fragment> >#P org.eclipse.equinox.security >Index: src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java,v >retrieving revision 1.11 >diff -u -r1.11 InternalExchangeUtils.java >--- src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java 25 Apr 2008 19:52:32 -0000 1.11 >+++ src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java 8 May 2008 20:45:01 -0000 >@@ -27,6 +27,8 @@ > */ > public class InternalExchangeUtils { > >+ static public final String HINT_PASSWORD_AUTOGEN = "AutomaticPasswordGeneration"; //$NON-NLS-1$ >+ > static private final String JUNIT_APPS1 = "org.eclipse.pde.junit.runtime."; //$NON-NLS-1$ > static private final String JUNIT_APPS2 = "org.eclipse.test."; //$NON-NLS-1$ > >@@ -52,7 +54,7 @@ > List result = new ArrayList(availableModules.size()); > for (Iterator i = availableModules.iterator(); i.hasNext();) { > ExtStorageModule module = (ExtStorageModule) i.next(); >- result.add(new PasswordProviderDescription(module.name, module.moduleID, module.priority)); >+ result.add(new PasswordProviderDescription(module.name, module.moduleID, module.priority, module.hints)); > } > return result; > } >Index: src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java,v >retrieving revision 1.2 >diff -u -r1.2 PasswordProviderDescription.java >--- src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java 25 Apr 2008 17:53:58 -0000 1.2 >+++ src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java 8 May 2008 20:45:01 -0000 >@@ -10,6 +10,9 @@ > *******************************************************************************/ > package org.eclipse.equinox.internal.security.storage.friends; > >+import java.util.Iterator; >+import java.util.List; >+ > /** > * This class is used to pass description of a password provider module. > */ >@@ -18,11 +21,13 @@ > private int priority; > private String id; > private String name; >+ private List hints; > >- public PasswordProviderDescription(String name, String id, int priority) { >+ public PasswordProviderDescription(String name, String id, int priority, List hints) { > this.id = id; > this.name = name; > this.priority = priority; >+ this.hints = hints; > } > > public int getPriority() { >@@ -33,6 +38,17 @@ > return id; > } > >+ public boolean hasHint(String hint) { >+ if (hints == null) >+ return false; >+ for (Iterator i = hints.iterator(); i.hasNext();) { >+ String candidate = (String) i.next(); >+ if (hint.equalsIgnoreCase(candidate)) >+ return true; >+ } >+ return false; >+ } >+ > public String getName() { > if (name == null || name.length() == 0) > return id; >Index: src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java,v >retrieving revision 1.6 >diff -u -r1.6 PasswordProviderSelector.java >--- src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java 25 Apr 2008 19:52:32 -0000 1.6 >+++ src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java 8 May 2008 20:45:01 -0000 >@@ -33,6 +33,8 @@ > final private static String STORAGE_MODULE = "provider";//$NON-NLS-1$ > final private static String MODULE_PRIORITY = "priority";//$NON-NLS-1$ > final private static String CLASS_NAME = "class";//$NON-NLS-1$ >+ final private static String HINTS_NAME = "hint";//$NON-NLS-1$ >+ final private static String HINT_VALUE = "value";//$NON-NLS-1$ > > private Map modules = new HashMap(5); // cache of modules found > >@@ -41,13 +43,15 @@ > public IConfigurationElement element; > public int priority; > public String name; >+ public List hints; > >- public ExtStorageModule(String id, IConfigurationElement element, int priority, String name) { >+ public ExtStorageModule(String id, IConfigurationElement element, int priority, String name, List hints) { > super(); > this.element = element; > this.moduleID = id; > this.priority = priority; > this.name = name; >+ this.hints = hints; > } > } > >@@ -107,7 +111,19 @@ > priority = 10; > } > String name = extensions[i].getLabel(); >- allAvailableModules.add(new ExtStorageModule(moduleID, element, priority, name)); >+ >+ List suppliedHints = null; >+ IConfigurationElement[] hints = element.getChildren(HINTS_NAME); >+ if (hints.length != 0) { >+ suppliedHints = new ArrayList(hints.length); >+ for (int j = 0; j < hints.length; j++) { >+ String hint = hints[j].getAttribute(HINT_VALUE); >+ if (hint != null) >+ suppliedHints.add(hint); >+ } >+ } >+ >+ allAvailableModules.add(new ExtStorageModule(moduleID, element, priority, name, suppliedHints)); > } > > Collections.sort(allAvailableModules, new Comparator() { >@@ -148,7 +164,7 @@ > if (!(clazz instanceof PasswordProvider)) > continue; > >- PasswordProviderModuleExt result = new PasswordProviderModuleExt((PasswordProvider) clazz, module.moduleID); >+ PasswordProviderModuleExt result = new PasswordProviderModuleExt((PasswordProvider) clazz, module.moduleID); // , module.hints); > > // cache the result > synchronized (modules) { >#P org.eclipse.equinox.security.ui >Index: src/org/eclipse/equinox/internal/security/ui/nls/SecUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/nls/SecUIMessages.java,v >retrieving revision 1.18 >diff -u -r1.18 SecUIMessages.java >--- src/org/eclipse/equinox/internal/security/ui/nls/SecUIMessages.java 8 May 2008 15:02:53 -0000 1.18 >+++ src/org/eclipse/equinox/internal/security/ui/nls/SecUIMessages.java 8 May 2008 20:45:02 -0000 >@@ -145,6 +145,7 @@ > public static String wizardSwitchError; > public static String wizardDoneTitle; > public static String wizardDone; >+ public static String passwordChangeDone; > > // challenge-response dialog > public static String pswdRecoveryOptionTitle; >Index: src/org/eclipse/equinox/internal/security/ui/nls/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/nls/messages.properties,v >retrieving revision 1.23 >diff -u -r1.23 messages.properties >--- src/org/eclipse/equinox/internal/security/ui/nls/messages.properties 8 May 2008 15:08:24 -0000 1.23 >+++ src/org/eclipse/equinox/internal/security/ui/nls/messages.properties 8 May 2008 20:45:02 -0000 >@@ -139,6 +139,7 @@ > wizardSwitchError = A error occurred while creating new password. See error log for details. > wizardDoneTitle = Complete > wizardDone = Password change complete. >+passwordChangeDone = The \'master\' password has been successfully changed for the provider \"{0}\". > > ## challenge-response dialog > pswdRecoveryOptionTitle = Secure Storage >Index: src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java,v >retrieving revision 1.6 >diff -u -r1.6 TabPassword.java >--- src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java 8 May 2008 15:02:53 -0000 1.6 >+++ src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java 8 May 2008 20:45:02 -0000 >@@ -18,9 +18,11 @@ > import org.eclipse.equinox.internal.security.ui.nls.SecUIMessages; > import org.eclipse.equinox.security.storage.ISecurePreferences; > import org.eclipse.equinox.security.storage.SecurePreferencesFactory; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.layout.*; > import org.eclipse.jface.viewers.ColumnWeightData; > import org.eclipse.jface.viewers.TableLayout; >+import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.*; > import org.eclipse.swt.layout.GridData; >@@ -121,10 +123,19 @@ > } > > public void widgetSelected(SelectionEvent e) { >+ PasswordProviderDescription selectedModule = getSelectedModule(); >+ if (selectedModule == null) >+ return; > String moduleID = getSelectedModuleID(); > ISecurePreferences rootNode = SecurePreferencesFactory.getDefault(); >- ChangePasswordWizardDialog dialog = new ChangePasswordWizardDialog(shell, rootNode, moduleID); >- dialog.open(); >+ if (selectedModule.hasHint(InternalExchangeUtils.HINT_PASSWORD_AUTOGEN)) { >+ // do replacement behind the scene without showing the wizard >+ changePassword(rootNode, moduleID, selectedModule.getName(), shell); >+ } else { >+ // show the wizard to provide separate "old" and "new" password entries >+ ChangePasswordWizardDialog dialog = new ChangePasswordWizardDialog(shell, rootNode, moduleID); >+ dialog.open(); >+ } > enableLogout(); > } > }); >@@ -169,7 +180,7 @@ > PasswordProviderDescription module = (PasswordProviderDescription) i.next(); > TableItem item = new TableItem(providerTable, SWT.NONE); > item.setText(new String[] {module.getName(), Integer.toString(module.getPriority())}); >- item.setData(module.getId()); >+ item.setData(module); > if (disabledModules == null) > item.setChecked(true); > else >@@ -182,13 +193,20 @@ > providerTable.setLayout(layout); > } > >- protected String getSelectedModuleID() { >+ protected PasswordProviderDescription getSelectedModule() { > if (providerTable == null) > return null; > TableItem[] items = providerTable.getSelection(); > if (items.length == 0) > return null; >- return (String) items[0].getData(); >+ return ((PasswordProviderDescription) items[0].getData()); >+ } >+ >+ protected String getSelectedModuleID() { >+ PasswordProviderDescription selectedModule = getSelectedModule(); >+ if (selectedModule == null) >+ return null; >+ return selectedModule.getId(); > } > > protected void enableButtons() { >@@ -246,7 +264,7 @@ > tmp.append(','); > else > first = false; >- tmp.append((String) items[i].getData()); >+ tmp.append(((PasswordProviderDescription) items[i].getData()).getId()); > } > > IEclipsePreferences node = new ConfigurationScope().getNode(PREFERENCES_PLUGIN); >@@ -276,4 +294,29 @@ > GridDataFactory.defaultsFor(button).align(SWT.FILL, SWT.BEGINNING).grab(false, false).applyTo(button); > } > >+ protected boolean changePassword(ISecurePreferences node, String moduleID, String name, Shell shell) { >+ ReEncrypter reEncrypter = new ReEncrypter(node, moduleID); >+ if (!reEncrypter.decrypt()) { >+ MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_WARNING); >+ messageBox.setText(SecUIMessages.changePasswordWizardTitle); >+ messageBox.setMessage(SecUIMessages.wizardDecodeWarning); >+ if (messageBox.open() == SWT.YES) >+ return false; >+ } >+ >+ if (!reEncrypter.switchToNewPassword()) { >+ MessageBox messageBox = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); >+ messageBox.setText(SecUIMessages.changePasswordWizardTitle); >+ messageBox.setMessage(SecUIMessages.wizardSwitchError); >+ messageBox.open(); >+ return false; >+ } >+ reEncrypter.encrypt(); >+ >+ // all good >+ String msg = NLS.bind(SecUIMessages.passwordChangeDone, name); >+ MessageDialog.openInformation(StorageUtils.getShell(), SecUIMessages.generalDialogTitle, msg); >+ return true; >+ } >+ > }
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 230242
:
99377
|
99378
|
99482
|
99541