You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2013/07/13 16:09:57 UTC

svn commit: r1502789 - in /manifoldcf/branches/CONNECTORS-737/framework: crawler-ui/src/main/webapp/ ui-core/src/main/java/org/apache/manifoldcf/ui/beans/ ui-core/src/main/java/org/apache/manifoldcf/ui/jsp/ ui-core/src/main/java/org/apache/manifoldcf/u...

Author: kwright
Date: Sat Jul 13 14:09:57 2013
New Revision: 1502789

URL: http://svn.apache.org/r1502789
Log:
Add infrastructure for dealing with passwords.

Added:
    manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/passwords/
    manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/passwords/PasswordMapper.java   (with props)
Modified:
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editauthority.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editconnection.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editjob.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editmapper.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editoutput.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/login.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewauthority.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewconnection.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewjob.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewmapper.jsp
    manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewoutput.jsp
    manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/beans/AdminProfile.java
    manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/jsp/JspWrapper.java

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editauthority.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editauthority.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editauthority.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editauthority.jsp Sat Jul 13 14:09:57 2013
@@ -218,7 +218,7 @@
 	//-->
 	</script>
 <%
-	AuthorityConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters,tabsArray);
+	AuthorityConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabsArray);
 
 	// Get connectors, since this will be needed to determine what to display.
 	IResultSet set = connectorManager.getConnectors();
@@ -487,7 +487,7 @@
 	  }
 
 	  if (className.length() > 0)
-		AuthorityConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters,tabName);
+		AuthorityConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabName);
 %>
 		    <table class="displaytable">
 			<tr><td class="separator" colspan="4"><hr/></td></tr>

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editconnection.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editconnection.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editconnection.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editconnection.jsp Sat Jul 13 14:09:57 2013
@@ -254,7 +254,7 @@
 	//-->
 	</script>
 <%
-	RepositoryConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters,tabsArray);
+	RepositoryConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabsArray);
 %>
 
 </head>
@@ -567,7 +567,7 @@
 	  }
 
 	  if (className.length() > 0)
-		RepositoryConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters,tabName);
+		RepositoryConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabName);
 %>
 		    <table class="displaytable">
 			<tr><td class="separator" colspan="4"><hr/></td></tr>

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editjob.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editjob.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editjob.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editjob.jsp Sat Jul 13 14:09:57 2013
@@ -410,7 +410,7 @@
 		{
 			try
 			{
-				outputConnector.outputSpecificationHeader(new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),outputSpecification,tabsArray);
+				outputConnector.outputSpecificationHeader(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),outputSpecification,tabsArray);
 			}
 			finally
 			{
@@ -429,7 +429,7 @@
 		{
 			try
 			{
-				repositoryConnector.outputSpecificationHeader(new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),documentSpecification,tabsArray);
+				repositoryConnector.outputSpecificationHeader(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),documentSpecification,tabsArray);
 			}
 			finally
 			{
@@ -1278,7 +1278,7 @@
 		{
 			try
 			{
-				outputConnector.outputSpecificationBody(new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),outputSpecification,tabName);
+				outputConnector.outputSpecificationBody(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),outputSpecification,tabName);
 			}
 			finally
 			{
@@ -1298,7 +1298,7 @@
 		{
 			try
 			{
-				repositoryConnector.outputSpecificationBody(new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),documentSpecification,tabName);
+				repositoryConnector.outputSpecificationBody(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),documentSpecification,tabName);
 			}
 			finally
 			{

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editmapper.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editmapper.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editmapper.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editmapper.jsp Sat Jul 13 14:09:57 2013
@@ -216,7 +216,7 @@
 	//-->
 	</script>
 <%
-	MappingConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters,tabsArray);
+	MappingConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabsArray);
 
 	// Get connectors, since this will be needed to determine what to display.
 	IResultSet set = connectorManager.getConnectors();
@@ -486,7 +486,7 @@
 	  }
 
 	  if (className.length() > 0)
-		MappingConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters,tabName);
+		MappingConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabName);
 %>
 		    <table class="displaytable">
 			<tr><td class="separator" colspan="4"><hr/></td></tr>

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editoutput.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editoutput.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editoutput.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/editoutput.jsp Sat Jul 13 14:09:57 2013
@@ -212,7 +212,7 @@
 	//-->
 	</script>
 <%
-	OutputConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters,tabsArray);
+	OutputConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabsArray);
 %>
 
 </head>
@@ -415,7 +415,7 @@
 	  }
 
 	  if (className.length() > 0)
-		OutputConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters,tabName);
+		OutputConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters,tabName);
 
 %>
 		    <table class="displaytable">

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/login.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/login.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/login.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/login.jsp Sat Jul 13 14:09:57 2013
@@ -71,7 +71,7 @@ if (value != null && value.equals("true"
 							<tr><td class="separator" colspan="2"><hr/></td></tr>
 							<tr>
 								<td class="message" colspan="2">
-									<input type="button" onclick='Javascript:login();' value='<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"index.Login")%>'/>
+									<input type="button" onclick='Javascript:login();' value='<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"index.Login")%>' alt='<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"index.Login")%>'/>
 								</td>
 							</tr>
 						</table>

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewauthority.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewauthority.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewauthority.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewauthority.jsp Sat Jul 13 14:09:57 2013
@@ -164,7 +164,7 @@
 			<tr>
 				<td colspan="4">
 <%
-		AuthorityConnectorFactory.viewConfiguration(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters);
+		AuthorityConnectorFactory.viewConfiguration(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters);
 %>
 
 				</td>

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewconnection.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewconnection.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewconnection.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewconnection.jsp Sat Jul 13 14:09:57 2013
@@ -191,7 +191,7 @@
 			<tr>
 				<td colspan="4">
 <%
-		RepositoryConnectorFactory.viewConfiguration(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters);
+		RepositoryConnectorFactory.viewConfiguration(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters);
 %>
 				</td>
 			</tr>

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewjob.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewjob.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewjob.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewjob.jsp Sat Jul 13 14:09:57 2013
@@ -637,7 +637,7 @@
 			{
 				try
 				{
-					outputConnector.viewSpecification(new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),job.getOutputSpecification());
+					outputConnector.viewSpecification(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),job.getOutputSpecification());
 				}
 				finally
 				{
@@ -663,7 +663,7 @@
 			{
 				try
 				{
-					repositoryConnector.viewSpecification(new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),job.getSpecification());
+					repositoryConnector.viewSpecification(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),job.getSpecification());
 				}
 				finally
 				{

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewmapper.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewmapper.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewmapper.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewmapper.jsp Sat Jul 13 14:09:57 2013
@@ -160,7 +160,7 @@
 			<tr>
 				<td colspan="4">
 <%
-		MappingConnectorFactory.viewConfiguration(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters);
+		MappingConnectorFactory.viewConfiguration(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters);
 %>
 
 				</td>

Modified: manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewoutput.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewoutput.jsp?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewoutput.jsp (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/crawler-ui/src/main/webapp/viewoutput.jsp Sat Jul 13 14:09:57 2013
@@ -146,7 +146,7 @@
 			<tr>
 				<td colspan="4">
 <%
-		OutputConnectorFactory.viewConfiguration(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out),pageContext.getRequest().getLocale(),parameters);
+		OutputConnectorFactory.viewConfiguration(threadContext,className,new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),parameters);
 %>
 				</td>
 			</tr>

Modified: manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/beans/AdminProfile.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/beans/AdminProfile.java?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/beans/AdminProfile.java (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/beans/AdminProfile.java Sat Jul 13 14:09:57 2013
@@ -24,6 +24,7 @@ import javax.servlet.http.*;
 
 import org.apache.manifoldcf.core.interfaces.*;
 import org.apache.manifoldcf.core.system.*;
+import org.apache.manifoldcf.ui.passwords.PasswordMapper;
 
 /** The profile object contains an admin user's login information, and helps establish the
 * session model for the application.  This particular bean maintains the user (against
@@ -41,6 +42,8 @@ public class AdminProfile implements Htt
   private boolean isLoggedIn = false;
   /** Set to "true" if user can manage users. */
   private boolean manageUsers = false;
+  /** Password mapper */
+  private PasswordMapper passwordMapper = null;
 
   /** Session identifier */
   private String sessionIdentifier = null;
@@ -102,6 +105,7 @@ public class AdminProfile implements Htt
         loginTime = System.currentTimeMillis();
         this.userID = userID;
         manageUsers = false;
+        passwordMapper = new PasswordMapper();
       }
     }
     catch (ManifoldCFException e)
@@ -135,6 +139,14 @@ public class AdminProfile implements Htt
     return loginTime;
   }
 
+  /** Get the password mapper object.
+  *@return the password mapper object.
+  */
+  public PasswordMapper getPasswordMapper()
+  {
+    return passwordMapper;
+  }
+  
   // Nuke stuff for security and the garbage
   // collector threads
   private void sessionCleanup()
@@ -144,6 +156,7 @@ public class AdminProfile implements Htt
     userID = null;
     manageUsers = false;
     loginTime = -1L;
+    passwordMapper = null;
   }
 
 

Modified: manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/jsp/JspWrapper.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/jsp/JspWrapper.java?rev=1502789&r1=1502788&r2=1502789&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/jsp/JspWrapper.java (original)
+++ manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/jsp/JspWrapper.java Sat Jul 13 14:09:57 2013
@@ -19,23 +19,27 @@
 package org.apache.manifoldcf.ui.jsp;
 
 import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.ui.beans.AdminProfile;
 import javax.servlet.jsp.*;
 import java.io.*;
 
 /** This class provides an implementation of IHTTPOutput, which provides output
-* services to connector UI interfaces.
+* services to connector UI interfaces.  More broadly, it provides the services that all
+* connectors will need in order to provide UI components.
 */
 public class JspWrapper implements IHTTPOutput
 {
   public static final String _rcsid = "@(#)$Id: JspWrapper.java 988245 2010-08-23 18:39:35Z kwright $";
 
-  protected JspWriter writer;
+  protected final JspWriter writer;
+  protected final AdminProfile adminProfile;
 
   /** Constructor.
   */
-  public JspWrapper(JspWriter writer)
+  public JspWrapper(JspWriter writer, AdminProfile adminProfile)
   {
     this.writer = writer;
+    this.adminProfile = adminProfile;
   }
 
   /** Flush the stream */
@@ -178,4 +182,26 @@ public class JspWrapper implements IHTTP
     writer.println(s);
   }
 
+  /** Map a password to a unique key.
+  * This method works within a specific given browser session to replace an existing password with
+  * a key which can be used to look up the password at a later time.
+  *@param password is the password.
+  *@return the key.
+  */
+  public String mapPasswordToKey(String password)
+  {
+    return adminProfile.getPasswordMapper().mapPasswordToKey(password);
+  }
+  
+  /** Convert a key, created by mapPasswordToKey, back to the original password, within
+  * the lifetime of the browser session.  If the provided key is not an actual key, instead
+  * the key value is assumed to be a new password value.
+  *@param key is the key.
+  *@return the password.
+  */
+  public String mapKeyToPassword(String key)
+  {
+    return adminProfile.getPasswordMapper().mapKeyToPassword(key);
+  }
+
 }

Added: manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/passwords/PasswordMapper.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/passwords/PasswordMapper.java?rev=1502789&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/passwords/PasswordMapper.java (added)
+++ manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/passwords/PasswordMapper.java Sat Jul 13 14:09:57 2013
@@ -0,0 +1,101 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.ui.passwords;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.core.system.*;
+import java.util.*;
+
+/** This object manages a session-based map of password keys.
+*/
+public class PasswordMapper
+{
+  public static final String _rcsid = "@(#)$Id$";
+  
+  private final String randomPrefix;
+  private final Map<String,Integer> passwordToKey = new HashMap<String,Integer>();
+  private final List<String> passwordList = new ArrayList<String>();
+  
+  /** Constructor */
+  public PasswordMapper()
+  {
+    randomPrefix = generateRandomPrefix();
+  }
+  
+  /** Map a password to a key.
+  *@param password is the password.
+  *@return the key.
+  */
+  public synchronized String mapPasswordToKey(String password)
+  {
+    // Special case for null or empty password
+    if (password == null || password.length() == 0)
+      return password;
+    Integer index = passwordToKey.get(password);
+    if (index == null)
+    {
+      // Need a new key.
+      index = new Integer(passwordList.size());
+      passwordList.add(password);
+      passwordToKey.put(password,index);
+    }
+    return randomPrefix + index;
+  }
+  
+  /** Map a key back to a password.
+  *@param key is the key (or a password, if changed)
+  *@return the password.
+  */
+  public synchronized String mapKeyToPassword(String key)
+  {
+    if (key != null && key.startsWith(randomPrefix))
+    {
+      String intPart = key.substring(randomPrefix.length());
+      try
+      {
+        int index = Integer.parseInt(intPart);
+        if (index < passwordList.size())
+          return passwordList.get(index);
+      }
+      catch (NumberFormatException e)
+      {
+      }
+    }
+    return key;
+  }
+  
+  // Protected methods
+  
+  protected static char[] pickChars = new char[]{'\u0d5d','\u20c4','\u0392','\u1a2b'};
+  
+  /** Generate a random prefix that will not likely collide with any password */
+  protected static String generateRandomPrefix()
+  {
+    Random r = new Random(System.currentTimeMillis());
+    StringBuilder sb = new StringBuilder("_");
+    for (int i = 0; i < 8; i++)
+    {
+      int index = r.nextInt(pickChars.length);
+      sb.append(pickChars[index]);
+    }
+    sb.append("_");
+    return sb.toString();
+  }
+  
+}

Propchange: manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/passwords/PasswordMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-737/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/passwords/PasswordMapper.java
------------------------------------------------------------------------------
    svn:keywords = Id