[jboss-svn-commits] JBL Code SVN: r20769 - in labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools: src/org/guvnor/tools/utils/webdav and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jun 25 12:33:43 EDT 2008


Author: john.graham at jboss.org
Date: 2008-06-25 12:33:43 -0400 (Wed, 25 Jun 2008)
New Revision: 20769

Modified:
   labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/META-INF/MANIFEST.MF
   labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavAuthenticator.java
   labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavClient.java
   labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/wizards/GuvnorMainConfigPage.java
Log:
Refactor to use platform key-ring for user name and password

Modified: labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/META-INF/MANIFEST.MF
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/META-INF/MANIFEST.MF	2008-06-25 14:21:38 UTC (rev 20768)
+++ labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/META-INF/MANIFEST.MF	2008-06-25 16:33:43 UTC (rev 20769)
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %plugin.name
 Bundle-SymbolicName: org.guvnor.tools;singleton:=true
-Bundle-Version: 0.5.0.200806201438
+Bundle-Version: 0.5.0.200806251126
 Bundle-Activator: org.guvnor.tools.Activator
 Bundle-Vendor: %plugin.provider
 Bundle-Localization: plugin

Modified: labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavAuthenticator.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavAuthenticator.java	2008-06-25 14:21:38 UTC (rev 20768)
+++ labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavAuthenticator.java	2008-06-25 16:33:43 UTC (rev 20769)
@@ -1,7 +1,6 @@
 package org.guvnor.tools.utils.webdav;
 
 import java.net.URL;
-import java.util.HashMap;
 import java.util.Map;
 
 import org.eclipse.core.runtime.Platform;
@@ -9,36 +8,15 @@
 
 public class WebDavAuthenticator implements IAuthenticator {
 	
-	private class ServerAuthenInfo {
-		private String serverUrl;
-		private HashMap<String, Map<String, String>> authInfo;
-		
-		public ServerAuthenInfo(String serverUrl) {
-			this.serverUrl = serverUrl;
-			authInfo = new HashMap<String, Map<String, String>>();
-		}
-		public Map<String, String> getAuthenicationInfo(String scheme) {
-			return authInfo.get(scheme);
-		}
-		public void addAuthenicationInfo(String scheme, Map<String, String> info) {
-			authInfo.put(scheme, info);
-		}
-		public String getServerURL() {
-			return serverUrl;
-		}
-	}
+	private URL repLocation;
 	
-	private HashMap<String, ServerAuthenInfo> serverAuthMaps;
-
 	public WebDavAuthenticator() {
-		serverAuthMaps = new HashMap<String, ServerAuthenInfo>();
 	}
 	
 	@SuppressWarnings("unchecked")
-	public WebDavAuthenticator(URL serverUrl, String scheme) {
+	public WebDavAuthenticator(URL serverUrl) {
 		this();
-		Map info = Platform.getAuthorizationInfo(serverUrl, "", scheme);
-		addAuthenticationInfo(serverUrl, null, scheme, info);
+		repLocation = serverUrl;
 	}
 	
 	@SuppressWarnings("unchecked")
@@ -46,12 +24,7 @@
 			                         String realm,
 			                         String scheme, 
 			                         Map info) {
-		ServerAuthenInfo authInfo = serverAuthMaps.get(serverUrl);
-		if (authInfo == null) {
-			authInfo = new ServerAuthenInfo(serverUrl.getHost());
-			serverAuthMaps.put(serverUrl.getHost().toLowerCase(), authInfo);
-		}
-		authInfo.addAuthenicationInfo(scheme.toLowerCase(), info);
+		// Not storing any local authentication information: using the platform's key ring
 	}
 
 	public void addProtectionSpace(URL resourceUrl, 
@@ -63,11 +36,7 @@
 	public Map getAuthenticationInfo(URL serverUrl, 
 			                        String realm, 
 			                        String scheme) {
-		ServerAuthenInfo authInfo = serverAuthMaps.get(serverUrl.getHost().toLowerCase());
-		if (authInfo == null) {
-			return null;
-		}
-		return authInfo.getAuthenicationInfo(scheme.toLowerCase());
+		return Platform.getAuthorizationInfo(repLocation, "", scheme);
 	}
 
 	public String getProtectionSpace(URL resourceUrl) {

Modified: labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavClient.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavClient.java	2008-06-25 14:21:38 UTC (rev 20768)
+++ labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/webdav/WebDavClient.java	2008-06-25 16:33:43 UTC (rev 20769)
@@ -22,25 +22,15 @@
 	/**
 	 * Ctor for this wrapper WebDav client.
 	 * @param serverUrl The WebDav repository location (server)
-	 * @param scheme The authentication scheme { Basic | Digest }
 	 */
-	public WebDavClient(URL serverUrl, String scheme) {
-		WebDavAuthenticator authen =  new WebDavAuthenticator(serverUrl, scheme);
+	public WebDavClient(URL serverUrl) {
+		WebDavAuthenticator authen =  new WebDavAuthenticator(serverUrl);
 		HttpClient hClient = new HttpClient();
 		hClient.setAuthenticator(authen);
 		client = new RemoteDAVClient(new WebDAVFactory(), hClient);
 	}
 	
 	/**
-	 * Ctor for this wrapper WebDav client, assuming "basic" authentication.
-	 * @param serverUrl The WebDav repository location (server)
-	 */
-	public WebDavClient(URL serverUrl) {
-		// basic authentication is assumed as the default
-		this(serverUrl, "basic");
-	}
-	
-	/**
 	 * Provides access to the underlying RemoteDAVClient.
 	 * @return The client associated with the current repository connection.
 	 */

Modified: labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/wizards/GuvnorMainConfigPage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/wizards/GuvnorMainConfigPage.java	2008-06-25 14:21:38 UTC (rev 20768)
+++ labs/jbossrules/trunk/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/wizards/GuvnorMainConfigPage.java	2008-06-25 16:33:43 UTC (rev 20769)
@@ -62,6 +62,9 @@
 			}
 		});
 
+		new Label(composite, SWT.NONE).setText("NOTE: ") ;
+		new Label(composite, SWT.WRAP).setText("Saved passwords are stored on your computer in a file that is difficult, but not impossible, for an intruder to read.");
+		
 		super.setControl(composite);
 	}
 




More information about the jboss-svn-commits mailing list