mbed Connector Interface simplification API on top of mbed-client

Fork of mbedConnectorInterfaceV3 by Doug Anson

NOTE:

This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!

Revision:
24:c92984bede9c
Parent:
13:9edad7677211
Child:
38:bb6d2be4d54c
--- a/source/PassphraseAuthenticator.cpp	Sat Jun 11 02:34:34 2016 +0000
+++ b/source/PassphraseAuthenticator.cpp	Sun Jun 12 02:49:50 2016 +0000
@@ -40,12 +40,12 @@
 
 // basic (trivial passphrase authentication)
 bool PassphraseAuthenticator::authenticate(void *challenge) {
-#if defined (HAS_EXECUTE_PARAMS)
     // use simple, trivial passphrase based comparison as the check... 
     char *passphrase = (char *)this->m_secret;
     char *input_passphrase = NULL;
     
-    // unmarshall the challenge... its a simple string
+#if defined (HAS_EXECUTE_PARAMS)
+    // ExecParam mbed-client: un-marshall the ExecuteParameter to get the simple string...
     M2MResource::M2MExecuteParameter* param = (M2MResource::M2MExecuteParameter*)challenge;
     if (param != NULL) {
         // use parameters to extract the passphrase
@@ -55,6 +55,10 @@
         string value = this->coapDataToString(param->get_argument_value(),param->get_argument_value_length());
         input_passphrase = (char *)value.c_str();
     }
+#else 
+    // Non-ExecParam mbed-client: use the parameter directly... 
+    input_passphrase = (char *)challenge;
+#endif
     
     // DEBUG
     //this->m_logger->log("Authenticator(passphrase): passphrase: [%s] challenge: [%s]",passphrase,input_passphrase);
@@ -73,11 +77,6 @@
     
     // authentication failure
     return false;
-#else
-    // DEBUG
-    this->m_logger->log("Authenticator(passphrase): OLD mbed-client detected. Authentication OK (passthru)");
-    return true;
-#endif
 }
 
 // convenience method to get the URI from its buffer field...