Search in sources :

Example 41 with ISecurePreferences

use of org.eclipse.equinox.security.storage.ISecurePreferences in project ecf by eclipse.

the class IDEntry method getAssociates.

public IIDEntry[] getAssociates(String key) {
    if (key == null)
        return new IIDEntry[0];
    ISecurePreferences associateNode = prefs.node(key);
    String[] childrenNames = associateNode.childrenNames();
    SortedMap results = new TreeMap();
    for (int i = 0; i < childrenNames.length; i++) {
        addAssociateFromName(childrenNames[i], results);
    }
    return (IIDEntry[]) results.values().toArray(new IIDEntry[] {});
}
Also used : IIDEntry(org.eclipse.ecf.storage.IIDEntry) ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences)

Example 42 with ISecurePreferences

use of org.eclipse.equinox.security.storage.ISecurePreferences in project ecf by eclipse.

the class ContainerStoreTest method testStoreContainer.

public ID testStoreContainer() throws Exception {
    final IContainer container = createContainer();
    final IContainerEntry containerEntry = storeContainer(getStorableContainerAdapter(container));
    final ISecurePreferences prefs = containerEntry.getPreferences();
    assertNotNull(prefs);
    return container.getID();
}
Also used : ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences) IContainer(org.eclipse.ecf.core.IContainer) IContainerEntry(org.eclipse.ecf.storage.IContainerEntry)

Example 43 with ISecurePreferences

use of org.eclipse.equinox.security.storage.ISecurePreferences in project arduino-eclipse-plugin by Sloeber.

the class PasswordManager method setHost.

/**
 * Sets the host. If there is no Login,password for this host the method
 * returns false. If a login/password for the host is found the method
 * returns true
 *
 * @param host
 * @return
 */
public boolean setHost(String host) {
    this.myhost = host;
    this.myPassword = null;
    this.myLogin = null;
    String nodename = ConvertHostToNodeName(this.myhost);
    ISecurePreferences root = SecurePreferencesFactory.getDefault();
    try {
        if (root.nodeExists(nodename)) {
            ISecurePreferences node = root.node(nodename);
            this.myPassword = node.get(Messages.security_password, null);
            this.myLogin = node.get(Messages.security_login, null);
            return true;
        }
    } catch (StorageException e) {
        Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, "Set a password on the project properties->Sloeber page", // $NON-NLS-1$
        e));
    }
    return false;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences) StorageException(org.eclipse.equinox.security.storage.StorageException)

Example 44 with ISecurePreferences

use of org.eclipse.equinox.security.storage.ISecurePreferences in project arduino-eclipse-plugin by Sloeber.

the class PasswordManager method setPwd.

public static void setPwd(String host, String login, String pwd) {
    String nodename = ConvertHostToNodeName(host);
    ISecurePreferences root = SecurePreferencesFactory.getDefault();
    ISecurePreferences node = root.node(nodename);
    try {
        node.put(Messages.security_login, login, false);
        node.put(Messages.security_password, pwd, false);
    } catch (StorageException e) {
        // $NON-NLS-1$
        Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, "failed to set login info", e));
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences) StorageException(org.eclipse.equinox.security.storage.StorageException)

Example 45 with ISecurePreferences

use of org.eclipse.equinox.security.storage.ISecurePreferences in project jbosstools-openshift by jbosstools.

the class SecureStore method getNode.

private ISecurePreferences getNode(IStoreKey key) throws UnsupportedEncodingException, SecureStoreException {
    if (key == null) {
        throw new SecureStoreException("storage key is null.");
    }
    ISecurePreferences root = SecurePreferencesFactory.getDefault();
    ISecurePreferences node = root.node(key.getKey());
    if (node == null) {
        throw new SecureStoreException(NLS.bind("Could find storage node {0}", key.getKey()));
    }
    return node;
}
Also used : ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences)

Aggregations

ISecurePreferences (org.eclipse.equinox.security.storage.ISecurePreferences)46 StorageException (org.eclipse.equinox.security.storage.StorageException)13 Preferences (org.osgi.service.prefs.Preferences)5 IOException (java.io.IOException)4 DBASecureStorage (org.jkiss.dbeaver.model.app.DBASecureStorage)4 BackingStoreException (org.osgi.service.prefs.BackingStoreException)4 ArrayList (java.util.ArrayList)3 IStatus (org.eclipse.core.runtime.IStatus)3 Status (org.eclipse.core.runtime.Status)3 MdwSecurityException (com.centurylink.mdw.auth.MdwSecurityException)2 MdwAuthenticator (com.centurylink.mdw.designer.auth.MdwAuthenticator)2 User (com.centurylink.mdw.plugin.User)2 DiscoveryException (com.centurylink.mdw.plugin.designer.DiscoveryException)2 XmlException (org.apache.xmlbeans.XmlException)2 ResourceException (org.eclipse.core.internal.resources.ResourceException)2 CoreException (org.eclipse.core.runtime.CoreException)2 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)2 IDStoreException (org.eclipse.ecf.storage.IDStoreException)2 IIDEntry (org.eclipse.ecf.storage.IIDEntry)2 JavaModelException (org.eclipse.jdt.core.JavaModelException)2