Search in sources :

Example 26 with ISecurePreferences

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

the class PasswordManager method setLoginData.

/**
 * Sets the login and password for a host
 *
 * @param host
 * @param login
 * @param password
 * @throws Exception
 */
public void setLoginData(String host, String login, String password) throws Exception {
    this.myhost = host;
    this.myLogin = login;
    this.myPassword = password;
    String nodename = ConvertHostToNodeName(this.myhost);
    ISecurePreferences root = SecurePreferencesFactory.getDefault();
    ISecurePreferences node = root.node(nodename);
    node.put(Messages.security_login, this.myLogin, false);
    node.put(Messages.security_password, this.myPassword, true);
}
Also used : ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences)

Example 27 with ISecurePreferences

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

the class PasswordManager method ErasePassword.

public static void ErasePassword(String host) {
    String nodename = ConvertHostToNodeName(host);
    ISecurePreferences root = SecurePreferencesFactory.getDefault();
    if (root.nodeExists(nodename)) {
        ISecurePreferences node = root.node(nodename);
        // (Messages.security_password, null, true);
        node.removeNode();
    }
}
Also used : ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences)

Example 28 with ISecurePreferences

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

the class RegistryAccountStorageManager method remove.

public void remove(final IRegistryAccount info) {
    final ISecurePreferences preferences = getDockerNode();
    final String key = getKeyFor(info);
    preferences.remove(key);
}
Also used : ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences)

Example 29 with ISecurePreferences

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

the class RegistryAccountStorageManager method getDockerNode.

private ISecurePreferences getDockerNode() {
    final ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
    final ISecurePreferences dockerNode = preferences.node(// $NON-NLS-1$
    "org.eclipse.linuxtools.docker.ui.accounts");
    return dockerNode;
}
Also used : ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences)

Example 30 with ISecurePreferences

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

the class DockerConnection method storePassword.

private void storePassword(String uri, String username, String passwd) {
    ISecurePreferences root = SecurePreferencesFactory.getDefault();
    String key = DockerConnection.getPreferencesKey(uri, username);
    ISecurePreferences node = root.node(key);
    try {
        if (// $NON-NLS-1$
        passwd != null && !passwd.equals(""))
            // $NON-NLS-1$
            node.put("password", passwd, true);
    } catch (StorageException e) {
        Activator.log(e);
    }
}
Also used : ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences) StorageException(org.eclipse.equinox.security.storage.StorageException)

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