private ICredentials getAuthorizationInfo(URI link, String realm) throws CredentialsException { ISecurePreferences securePreferences = getSecurePreferences(); /* Check if Bundle is Stopped */ if (securePreferences == null) return null; /* Return from Equinox Security Storage */ if (securePreferences.nodeExists(SECURE_FEED_NODE)) { // Global Feed Node ISecurePreferences allFeedsPreferences = securePreferences.node(SECURE_FEED_NODE); if (allFeedsPreferences.nodeExists( EncodingUtils.encodeSlashes(link.toString()))) { // Feed Node ISecurePreferences feedPreferences = allFeedsPreferences.node(EncodingUtils.encodeSlashes(link.toString())); if (feedPreferences.nodeExists( EncodingUtils.encodeSlashes(realm != null ? realm : REALM))) { // Realm Node ISecurePreferences realmPreferences = feedPreferences.node(EncodingUtils.encodeSlashes(realm != null ? realm : REALM)); try { String username = realmPreferences.get(USERNAME, null); String password = realmPreferences.get(PASSWORD, null); String domain = realmPreferences.get(DOMAIN, null); if (username != null && password != null) return new Credentials(username, password, domain); } catch (StorageException e) { throw new CredentialsException( Activator.getDefault().createErrorStatus(e.getMessage(), e)); } } } } return null; }
/* * @see * org.rssowl.core.connection.ICredentialsProvider#deleteAuthCredentials(java * .net.URI, java.lang.String) */ public synchronized void deleteAuthCredentials(URI link, String realm) throws CredentialsException { /* Delete from In-Memory Store if present */ fInMemoryStore.remove(toCacheKey(link, realm)); /* Delete from Cache */ removeUnprotected(link, realm); /* Check if Bundle is Stopped */ ISecurePreferences securePreferences = getSecurePreferences(); if (securePreferences == null) return; /* Remove from Equinox Security Storage */ if (securePreferences.nodeExists(SECURE_FEED_NODE)) { // Global Feed Node ISecurePreferences allFeedsPreferences = securePreferences.node(SECURE_FEED_NODE); if (allFeedsPreferences.nodeExists( EncodingUtils.encodeSlashes(link.toString()))) { // Feed Node ISecurePreferences feedPreferences = allFeedsPreferences.node(EncodingUtils.encodeSlashes(link.toString())); if (feedPreferences.nodeExists( EncodingUtils.encodeSlashes(realm != null ? realm : REALM))) { // Realm Node ISecurePreferences realmPreferences = feedPreferences.node(EncodingUtils.encodeSlashes(realm != null ? realm : REALM)); realmPreferences.clear(); realmPreferences.removeNode(); try { feedPreferences.flush(); } catch (IOException e) { throw new CredentialsException( Activator.getDefault().createErrorStatus(e.getMessage(), e)); } } } } }