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 99541 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]
Combined patch with updated schema
patch secure storage Hint Complete 2.txt (text/plain), 21.49 KB, created by
Oleg Besedin
on 2008-05-09 15:27:51 EDT
(
hide
)
Description:
Combined patch with updated schema
Filename:
MIME Type:
Creator:
Oleg Besedin
Created:
2008-05-09 15:27:51 EDT
Size:
21.49 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 9 May 2008 19:25:58 -0000 >@@ -7,7 +7,11 @@ > point="org.eclipse.equinox.security.secureStorage"> > <provider > class="org.eclipse.equinox.internal.security.win32.WinCrypto" >+ description="%providerDescription" > priority="5"> >+ <hint >+ value="AutomaticPasswordGeneration"> >+ </hint> > </provider> > </extension> > >Index: fragment.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.win32.x86/fragment.properties,v >retrieving revision 1.2 >diff -u -r1.2 fragment.properties >--- fragment.properties 25 Apr 2008 17:53:59 -0000 1.2 >+++ fragment.properties 9 May 2008 19:25:58 -0000 >@@ -11,3 +11,4 @@ > fragmentName = Windows Data Protection services integration > providerName = Eclipse.org > windowsModuleName = Windows Integration >+providerDescription = The provider uses Windows APIs to encrypt a randomly generated \'master\' password in a way specific to the login credentials. Users who can log into the Windows account can access contents of the secure storage. >#P org.eclipse.equinox.security.macosx >Index: fragment.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.macosx/fragment.properties,v >retrieving revision 1.2 >diff -u -r1.2 fragment.properties >--- fragment.properties 25 Apr 2008 17:53:55 -0000 1.2 >+++ fragment.properties 9 May 2008 19:25:59 -0000 >@@ -11,3 +11,4 @@ > fragmentName = OS X Keystore service integration > providerName = Eclipse.org > macModuleName = OS X Keystore Integration >+providerDescription = The provider uses the operating system\'s keyring to store a randomly generated user-specific \'master\' password. Users who can log into the operating system account can access contents of the secure storage. >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 9 May 2008 19:25:59 -0000 >@@ -7,7 +7,11 @@ > point="org.eclipse.equinox.security.secureStorage"> > <provider > class="org.eclipse.equinox.internal.security.osx.OSXProvider" >+ description="%providerDescription" > 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 9 May 2008 19:25:59 -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.description, 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 9 May 2008 19:25:59 -0000 >@@ -10,19 +10,28 @@ > *******************************************************************************/ > 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. > */ > public class PasswordProviderDescription { > >+ static final private String EMPTY_STRING = ""; //$NON-NLS-1$ >+ > private int priority; > private String id; > private String name; >+ private String description; >+ private List hints; > >- public PasswordProviderDescription(String name, String id, int priority) { >+ public PasswordProviderDescription(String name, String id, int priority, String description, List hints) { > this.id = id; > this.name = name; > this.priority = priority; >+ this.description = description; >+ this.hints = hints; > } > > public int getPriority() { >@@ -33,6 +42,21 @@ > return id; > } > >+ public String getDescription() { >+ return (description == null) ? EMPTY_STRING : description; >+ } >+ >+ 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: schema/secureStorage.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security/schema/secureStorage.exsd,v >retrieving revision 1.3 >diff -u -r1.3 secureStorage.exsd >--- schema/secureStorage.exsd 14 Apr 2008 21:48:44 -0000 1.3 >+++ schema/secureStorage.exsd 9 May 2008 19:25:59 -0000 >@@ -44,6 +44,9 @@ > > <element name="provider"> > <complexType> >+ <sequence> >+ <element ref="hint" minOccurs="0" maxOccurs="unbounded"/> >+ </sequence> > <attribute name="class" type="string" use="required"> > <annotation> > <documentation> >@@ -61,6 +64,34 @@ > </documentation> > </annotation> > </attribute> >+ <attribute name="description" type="string"> >+ <annotation> >+ <documentation> >+ Optional text describing to the user functionality of this password provider. >+ </documentation> >+ <appinfo> >+ <meta.attribute translatable="true"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="hint"> >+ <complexType> >+ <attribute name="value" use="required"> >+ <annotation> >+ <documentation> >+ To help secure storage optimize workflows, providers that acquire master passwords without input from the user the should specify <tt>AutomaticPasswordGeneration</tt> hint. >+ </documentation> >+ </annotation> >+ <simpleType> >+ <restriction base="string"> >+ <enumeration value="AutomaticPasswordGeneration"> >+ </enumeration> >+ </restriction> >+ </simpleType> >+ </attribute> > </complexType> > </element> > >@@ -100,7 +131,6 @@ > <documentation> > <p>The <code>org.eclipse.equinox.security.ui</code> bundle supplies default password provider that prompts user to enter the password.</p> > <p>The <code>org.eclipse.equinox.security.win32.x86</code> fragment provides Windows OS integration.</p> >- > </documentation> > </annotation> > >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 9 May 2008 19:25:59 -0000 >@@ -32,7 +32,10 @@ > final private static String EXTENSION_POINT = "org.eclipse.equinox.security.secureStorage"; //$NON-NLS-1$ > final private static String STORAGE_MODULE = "provider";//$NON-NLS-1$ > final private static String MODULE_PRIORITY = "priority";//$NON-NLS-1$ >+ final private static String MODULE_DESCRIPTION = "description";//$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 +44,17 @@ > public IConfigurationElement element; > public int priority; > public String name; >+ public String description; >+ public List hints; > >- public ExtStorageModule(String id, IConfigurationElement element, int priority, String name) { >+ public ExtStorageModule(String id, IConfigurationElement element, int priority, String name, String description, List hints) { > super(); > this.element = element; > this.moduleID = id; > this.priority = priority; > this.name = name; >+ this.description = description; >+ this.hints = hints; > } > } > >@@ -107,7 +114,21 @@ > priority = 10; > } > String name = extensions[i].getLabel(); >- allAvailableModules.add(new ExtStorageModule(moduleID, element, priority, name)); >+ >+ String description = element.getAttribute(MODULE_DESCRIPTION); >+ >+ 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, description, suppliedHints)); > } > > Collections.sort(allAvailableModules, new Comparator() { >#P org.eclipse.equinox.security.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.ui/plugin.xml,v >retrieving revision 1.12 >diff -u -r1.12 plugin.xml >--- plugin.xml 29 Apr 2008 01:03:11 -0000 1.12 >+++ plugin.xml 9 May 2008 19:26:00 -0000 >@@ -63,6 +63,7 @@ > point="org.eclipse.equinox.security.secureStorage"> > <provider > class="org.eclipse.equinox.internal.security.ui.storage.DefaultPasswordProvider" >+ description="%providerDescription" > priority="2"> > </provider> > </extension> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.ui/plugin.properties,v >retrieving revision 1.8 >diff -u -r1.8 plugin.properties >--- plugin.properties 25 Apr 2008 17:53:58 -0000 1.8 >+++ plugin.properties 9 May 2008 19:26:00 -0000 >@@ -19,3 +19,4 @@ > certificateFileDescription = Import certificates into the platform. > storage = Secure Storage > uiPasswordProviderName = UI Prompt >+providerDescription = The provider brings up a secure storage login dialog for the user to input the \'master\' password. This provider does not persist \'master\' password in any way but relies on the user to input it. >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 9 May 2008 19:26:00 -0000 >@@ -70,6 +70,7 @@ > public static String passwordCacheGroup; > public static String providerGroup; > public static String passwordCacheNote; >+ public static String providerDetails; > > // secure storage view > public static String generalTitle; >@@ -145,6 +146,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.24 >diff -u -r1.24 messages.properties >--- src/org/eclipse/equinox/internal/security/ui/nls/messages.properties 9 May 2008 13:31:16 -0000 1.24 >+++ src/org/eclipse/equinox/internal/security/ui/nls/messages.properties 9 May 2008 19:26:00 -0000 >@@ -64,6 +64,7 @@ > exportButton = &Export... > locationButton = S&torage location: > providerDescription = Providers supply \'master\' passwords used to encrypt information. The enabled provider with the highest priority is chosen. A provider can be disabled by un-checking it from this list. >+providerDetails = Details: > > ## Secure storage view > generalTitle = Secure Storage >@@ -139,6 +140,7 @@ > wizardSwitchError = An 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 9 May 2008 19:26:00 -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; >@@ -40,6 +42,8 @@ > protected Button buttonChangePassword; > protected Button buttonRecoverPassword; > >+ protected Text detailsText; >+ > protected boolean providerModified = false; > > public TabPassword(TabFolder folder, int index, final Shell shell) { >@@ -107,6 +111,7 @@ > if ((e.detail & SWT.CHECK) != 0) > providerModified = true; > enableButtons(); >+ updateDescription(); > } > }); > GridDataFactory.defaultsFor(providerTable).span(1, 2).applyTo(providerTable); >@@ -121,10 +126,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(); > } > }); >@@ -153,6 +167,19 @@ > setButtonSize(buttonRecoverPassword); > > enableButtons(); >+ >+ Label descriptionLabel = new Label(providersComp, SWT.NONE); >+ descriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); >+ descriptionLabel.setText(SecUIMessages.providerDetails); >+ >+ detailsText = new Text(providersComp, SWT.MULTI | SWT.LEAD | SWT.BORDER | SWT.READ_ONLY | SWT.WRAP); >+ detailsText.setBackground(detailsText.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); >+ gridData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); >+ gridData.widthHint = 300; >+ gridData.heightHint = 65; >+ detailsText.setLayoutData(gridData); >+ updateDescription(); >+ > GridLayoutFactory.fillDefaults().margins(LayoutConstants.getSpacing()).generateLayout(page); > } > >@@ -169,7 +196,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 >@@ -180,15 +207,25 @@ > layout.addColumnData(new ColumnWeightData(5)); > layout.addColumnData(new ColumnWeightData(1)); > providerTable.setLayout(layout); >+ >+ if (providerTable.getItemCount() > 0) >+ providerTable.select(0); > } > >- 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 +283,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 +313,35 @@ > 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; >+ } >+ >+ protected void updateDescription() { >+ PasswordProviderDescription selectedModule = getSelectedModule(); >+ if (selectedModule != null && detailsText != null) >+ detailsText.setText(selectedModule.getDescription()); >+ } >+ > }
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