diff --git a/src/org/yawlfoundation/yawl/engine/interfce/interfaceB/InterfaceB_EngineBasedServer.java b/src/org/yawlfoundation/yawl/engine/interfce/interfaceB/InterfaceB_EngineBasedServer.java index e19513269..e88b5753d 100644 --- a/src/org/yawlfoundation/yawl/engine/interfce/interfaceB/InterfaceB_EngineBasedServer.java +++ b/src/org/yawlfoundation/yawl/engine/interfce/interfaceB/InterfaceB_EngineBasedServer.java @@ -18,31 +18,39 @@ package org.yawlfoundation.yawl.engine.interfce.interfaceB; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Method; +import java.net.URI; +import java.net.URISyntaxException; +import java.rmi.RemoteException; +import java.security.NoSuchAlgorithmException; +import java.util.Date; +import java.util.Enumeration; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.UnavailableException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.yawlfoundation.yawl.elements.data.external.ExternalDataGatewayFactory; import org.yawlfoundation.yawl.elements.predicate.PredicateEvaluatorFactory; import org.yawlfoundation.yawl.engine.ObserverGateway; import org.yawlfoundation.yawl.engine.YEngine; import org.yawlfoundation.yawl.engine.YSpecificationID; -import org.yawlfoundation.yawl.engine.interfce.*; +import org.yawlfoundation.yawl.engine.interfce.EngineGateway; +import org.yawlfoundation.yawl.engine.interfce.EngineGatewayImpl; +import org.yawlfoundation.yawl.engine.interfce.PerfReporter; +import org.yawlfoundation.yawl.engine.interfce.ServletUtils; +import org.yawlfoundation.yawl.engine.interfce.YHttpServlet; import org.yawlfoundation.yawl.engine.time.workdays.HolidayLoader; import org.yawlfoundation.yawl.exceptions.YAWLException; import org.yawlfoundation.yawl.exceptions.YPersistenceException; +import org.yawlfoundation.yawl.util.PasswordEncryptor; import org.yawlfoundation.yawl.util.StringUtil; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.UnavailableException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.lang.reflect.Method; -import java.net.URI; -import java.net.URISyntaxException; -import java.rmi.RemoteException; -import java.util.Date; -import java.util.Enumeration; - /** * Receives & responds to POST messages from custom services @@ -271,6 +279,14 @@ public class InterfaceB_EngineBasedServer extends YHttpServlet { else if (action.equals("connect")) { String userID = request.getParameter("userid"); String password = request.getParameter("password"); + String encrypt = request.getParameter("encrypt"); + if ((encrypt != null) && encrypt.equalsIgnoreCase("true")) { + try { + password = PasswordEncryptor.encrypt(password); + } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { + // nothing to do - call will return 'incorrect password' + } + } int interval = request.getSession().getMaxInactiveInterval(); msg.append(_engine.connect(userID, password, interval)); }