public ServerConfiguration getConfig() { Builder builder = getConfigBuilderNoCredentials(getHost(), getOrganization()); if (hasAuth()) { try { builder.credentials(ServersManager.getUsername(this), ServersManager.getPassword(this)); } catch (StorageException e) { throw new IllegalStateException("Unable to read server credentials from storage: " + e.getMessage(), e); } } return builder.build(); }
private void loadProxyAuth(IProxyData data) { ISecurePreferences node = getNode(); if (node == null) return; try { data.setUserid(node.get(INFO_PROXY_USER, null)); data.setPassword(node.get(INFO_PROXY_PASS, null)); } catch (StorageException e) { Activator.logError(e.getMessage(), e); } }
/** * Result: Map: * <String>cipher -> <String>keyFactory */ public HashMap detect() { IUICallbacks callback = CallbacksProvider.getDefault().getCallback(); if (callback == null) return internalDetect(); IStorageTask task = new IStorageTask() { public void execute() { internalDetect(); } }; try { callback.execute(task); } catch (StorageException e) { // should not happen in this path AuthPlugin.getDefault().logError(e.getMessage(), e); } return availableCiphers; }
/** * Result: Map: * <String>cipher -> <String>keyFactory */ public HashMap<String, String> detect() { IUICallbacks callback = CallbacksProvider.getDefault().getCallback(); if (callback == null) return internalDetect(); IStorageTask task = () -> internalDetect(); try { callback.execute(task); } catch (StorageException e) { // should not happen in this path AuthPlugin.getDefault().logError(e.getMessage(), e); } return availableCiphers; }
private void saveProxyAuth(IProxyData data) { ISecurePreferences node= getNode(); if (node == null) return; try { if (data.getUserId() != null) node.put(INFO_PROXY_USER, data.getUserId(), true /* store encrypted */); else node.remove(INFO_PROXY_USER); if (data.getPassword() != null) node.put(INFO_PROXY_PASS, data.getPassword(), true /* store encrypted */); else node.remove(INFO_PROXY_PASS); } catch (StorageException e) { Activator.logError(e.getMessage(), e); return; } // optional: save it right away in case something crashes later try { node.flush(); } catch (IOException e) { Activator.logError(e.getMessage(), e); return; } }