Search in sources :

Example 1 with SecureStoreException

use of org.jboss.tools.openshift.internal.common.core.security.SecureStoreException 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 SecureStoreException

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

the class ConnectionWizardPage method connect.

public boolean connect() {
    try {
        ConnectJob connectJob = new ConnectJob();
        WizardUtils.runInWizard(connectJob, new DelegatingProgressMonitor(), getContainer(), getDatabindingContext());
        boolean connected = JobUtils.isOk(connectJob.getConnectionStatus());
        if (connected) {
            // update the connection and save it
            advConnectionEditors.saveChanges(pageModel);
            boolean result = pageModel.saveConnection();
            if (result) {
                SecureStoreException e = pageModel.getRecentSecureStoreException();
                if (e != null && e.getCause() instanceof StorageException) {
                    result = false;
                    Display.getDefault().asyncExec(new Runnable() {

                        @Override
                        public void run() {
                            String message = "Connection is successful, but access to secure storage is denied.\n" + "Please change save password/token settings and try again.\n" + "Be aware, that if you select 'Cancel' at this point, you will " + "be prompted for secure storage at each request for resources.";
                            MessageDialog.openWarning(getWizard().getContainer().getShell(), "Warning", message);
                        }
                    });
                }
            }
            return result;
        } else {
            return false;
        }
    } catch (InterruptedException e) {
        OpenShiftCommonUIActivator.log(NLS.bind("Failed to authenticate user on server at {1}", pageModel.getHost()), e);
        return false;
    } catch (InvocationTargetException e) {
        OpenShiftCommonUIActivator.log(NLS.bind("Failed to authenticate user on server at {1}", pageModel.getHost()), e);
        return false;
    }
}
Also used : SecureStoreException(org.jboss.tools.openshift.internal.common.core.security.SecureStoreException) DelegatingProgressMonitor(org.jboss.tools.foundation.core.jobs.DelegatingProgressMonitor) StorageException(org.eclipse.equinox.security.storage.StorageException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

SecureStoreException (org.jboss.tools.openshift.internal.common.core.security.SecureStoreException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 StorageException (org.eclipse.equinox.security.storage.StorageException)1 DelegatingProgressMonitor (org.jboss.tools.foundation.core.jobs.DelegatingProgressMonitor)1 SecureStore (org.jboss.tools.openshift.internal.common.core.security.SecureStore)1