Cleans up SP auth, parse resps, store for display, etc
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / ServiceProxyClient.java
index 79d6153..9493e49 100644 (file)
@@ -38,7 +38,6 @@ import com.indexdata.mkjsf.pazpar2.commands.CommandParameter;
 import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command;\r
 import com.indexdata.mkjsf.pazpar2.commands.sp.AuthCommand;\r
 import com.indexdata.mkjsf.pazpar2.data.CommandError;\r
-import com.indexdata.mkjsf.pazpar2.sp.auth.ServiceProxyUser;\r
 import com.indexdata.mkjsf.utils.Utils;\r
 \r
 public class ServiceProxyClient implements SearchClient {\r
@@ -81,63 +80,11 @@ public class ServiceProxyClient implements SearchClient {
       c.printStackTrace();\r
     }    \r
   }\r
-  \r
-  \r
-  public boolean authenticate (ServiceProxyUser user) {\r
-    logger.info("Authenticating [" + user.getProperty("name") + "]");            \r
-    Pazpar2Command auth = new AuthCommand(null);\r
-    auth.setParametersInState(new CommandParameter("action","=","login"), \r
-                              new CommandParameter("username","=",user.getProperty("name")), \r
-                              new CommandParameter("password","=",user.getProperty("password")));                                \r
-    ClientCommandResponse commandResponse = send(auth);\r
-    String responseStr = commandResponse.getResponseString();\r
-    logger.info(responseStr);      \r
-    if (responseStr.contains("FAIL")) {\r
-      user.credentialsAuthenticationSucceeded(false);\r
-      return false;\r
-    } else {\r
-      user.credentialsAuthenticationSucceeded(true);\r
-      return true;\r
-    }      \r
-  }\r
-  \r
-  public boolean checkAuthentication (ServiceProxyUser user) {    \r
-    ClientCommandResponse commandResponse = send(checkAuth);      \r
-    String responseStr = commandResponse.getResponseString();    \r
-    logger.info(responseStr);\r
-    if (responseStr.contains("FAIL")) {  \r
-      user.authenticationCheckFailed();\r
-      return false;\r
-    } else {                \r
-      return true;\r
-    }      \r
-  }\r
-  \r
-  public boolean ipAuthenticate (ServiceProxyUser user) {\r
-    ClientCommandResponse commandResponse = send(ipAuth);      \r
-    String responseStr = commandResponse.getResponseString();\r
-    logger.info(responseStr);\r
-    if (responseStr.contains("FAIL")) {\r
-      user.ipAuthenticationSucceeded(false);        \r
-      return false;\r
-    } else {\r
-      user.ipAuthenticationSucceeded(true);\r
-      return true;\r
-    }          \r
-  }\r
-  \r
+    \r
   public boolean isAuthenticatingClient () {\r
     return true;\r
   }\r
-  \r
-  public boolean isAuthenticated (ServiceProxyUser user) {\r
-    if (user.getProperty("name") != null && user.getProperty("password") != null) {\r
-      return checkAuthentication(user);\r
-    } else {\r
-      return false;\r
-    }\r
-  }\r
-  \r
+    \r
   /**\r
    * Makes the request\r
    * @param request\r
@@ -145,7 +92,7 @@ public class ServiceProxyClient implements SearchClient {
    * @throws ClientProtocolException\r
    * @throws IOException\r
    */\r
-  private ClientCommandResponse send(Pazpar2Command command) {\r
+  public ClientCommandResponse send(Pazpar2Command command) {\r
     ClientCommandResponse commandResponse = null;\r
     String url = serviceUrl + "?" + command.getEncodedQueryString(); \r
     logger.info("Sending request "+url);    \r