- } catch (ConfigurationException c) {\r
- // TODO: \r
- 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