Search in sources :

Example 1 with SecureStore

use of org.jboss.tools.openshift.internal.common.core.security.SecureStore in project jbosstools-openshift by jbosstools.

the class Connection method load.

protected String load(String id) {
    String value = null;
    SecureStore store = getSecureStore(getHost(), getUsername());
    if (store != null) {
        try {
            value = store.get(id);
        } catch (SecureStoreException e) {
            OpenShiftCoreActivator.pluginLog().logError(e.getMessage(), e);
        }
    }
    return value;
}
Also used : SecureStoreException(org.jboss.tools.openshift.internal.common.core.security.SecureStoreException) SecureStore(org.jboss.tools.openshift.internal.common.core.security.SecureStore)

Example 2 with SecureStore

use of org.jboss.tools.openshift.internal.common.core.security.SecureStore in project jbosstools-openshift by jbosstools.

the class SecureStorageTest method setUp.

@BeforeClass
public static void setUp() throws CoreException {
    key = new OpenShiftSecureStorageKey("org.jboss.tools.openshift.test", "localhost", "foobar");
    store = new SecureStore(key);
}
Also used : OpenShiftSecureStorageKey(org.jboss.tools.openshift.internal.common.core.security.OpenShiftSecureStorageKey) SecureStore(org.jboss.tools.openshift.internal.common.core.security.SecureStore) BeforeClass(org.junit.BeforeClass)

Example 3 with SecureStore

use of org.jboss.tools.openshift.internal.common.core.security.SecureStore in project jbosstools-openshift by jbosstools.

the class SecureStorageTest method shouldRemoveNode.

@Test
public void shouldRemoveNode() throws SecureStoreException {
    // pre-condition
    IStoreKey key = new OpenShiftSecureStorageKey("org.jboss.tools.openshift.test", "localhost", "foobar");
    SecureStore store = new SecureStore(key);
    store.put("password", "chocolate");
    assertTrue(SecurePreferencesFactory.getDefault().nodeExists(key.getKey()));
    // operation
    store.removeNode();
    // verification
    assertFalse(SecurePreferencesFactory.getDefault().nodeExists(key.getKey()));
}
Also used : IStoreKey(org.jboss.tools.openshift.internal.common.core.security.SecureStore.IStoreKey) OpenShiftSecureStorageKey(org.jboss.tools.openshift.internal.common.core.security.OpenShiftSecureStorageKey) SecureStore(org.jboss.tools.openshift.internal.common.core.security.SecureStore) Test(org.junit.Test)

Aggregations

SecureStore (org.jboss.tools.openshift.internal.common.core.security.SecureStore)3 OpenShiftSecureStorageKey (org.jboss.tools.openshift.internal.common.core.security.OpenShiftSecureStorageKey)2 IStoreKey (org.jboss.tools.openshift.internal.common.core.security.SecureStore.IStoreKey)1 SecureStoreException (org.jboss.tools.openshift.internal.common.core.security.SecureStoreException)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1