Skip to content

Commit

Permalink
Add authentication method to device structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoltan Varga committed Jan 17, 2017
1 parent 34e63e4 commit 6728716
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 7 deletions.
@@ -0,0 +1 @@
from .iothub_client import *
@@ -0,0 +1 @@
from .iothub_client import *
@@ -0,0 +1 @@
from .iothub_service_client import *
@@ -0,0 +1 @@
from .iothub_service_client import *
2 changes: 1 addition & 1 deletion c
Submodule c updated 93 files
+0 −1 CMakeLists.txt
+1 −1 build_all/arduino_cc/base-libraries/AzureIoTHub/library.properties
+1 −1 build_all/arduino_cc/base-libraries/AzureIoTHub/src/AzureIoTHub.h
+1 −1 build_all/arduino_cc/base-libraries/AzureIoTProtocol_HTTP/library.properties
+1 −1 build_all/arduino_cc/base-libraries/AzureIoTProtocol_HTTP/src/AzureIoTProtocol_HTTP.h
+1 −1 build_all/arduino_cc/base-libraries/AzureIoTProtocol_MQTT/library.properties
+1 −1 build_all/arduino_cc/base-libraries/AzureIoTProtocol_MQTT/src/AzureIoTProtocol_MQTT.h
+1 −1 build_all/arduino_cc/base-libraries/AzureIoTUtility/library.properties
+1 −1 build_all/arduino_cc/base-libraries/AzureIoTUtility/src/AzureIoTUtility.h
+1 −1 build_all/packaging/linux/debian/changelog-trusty
+1 −1 build_all/packaging/linux/debian/changelog-vivid
+1 −1 build_all/packaging/linux/debian/changelog-wily
+1 −1 build_all/packaging/linux/debian/changelog-xenial
+4 −4 build_all/packaging/windows/Microsoft.Azure.IoTHub.AmqpTransport.nuspec
+3 −3 build_all/packaging/windows/Microsoft.Azure.IoTHub.HttpTransport.nuspec
+2 −2 build_all/packaging/windows/Microsoft.Azure.IoTHub.IoTHubClient.nuspec
+4 −4 build_all/packaging/windows/Microsoft.Azure.IoTHub.MqttTransport.nuspec
+2 −2 build_all/packaging/windows/Microsoft.Azure.IoTHub.Serializer.nuspec
+47 −0 build_all/tizenRT/Make.defs
+39 −0 build_all/tizenRT/Makefile
+1 −1 c-utility
+2 −0 certs/certs.c
+ doc/media/tizenRT1.png
+ doc/media/tizenRT2.png
+ doc/media/tizenRT3.png
+ doc/media/tizenRT4.png
+ doc/media/tizenRT5.png
+ doc/media/tizenRT6.png
+ doc/media/tizenRT7.png
+ doc/media/tizenRT8.png
+120 −0 doc/tizenRT_s5jt200_get_started.md
+2 −0 iothub_client/CMakeLists.txt
+293 −0 iothub_client/devdoc/requirement_docs/iothubtransport_amqp_cbs_auth_requirements.md
+1 −1 iothub_client/inc/iothub_client_version.h
+67 −0 iothub_client/inc/iothubtransport_amqp_cbs_auth.h
+8 −8 iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.vcxproj
+4 −4 iothub_client/samples/iothub_client_sample_amqp/windows/packages.config
+6 −6 iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.vcxproj
+3 −3 iothub_client/samples/iothub_client_sample_http/windows/packages.config
+6 −6 iothub_client/samples/iothub_client_sample_http_shared/windows/iothub_client_sample_http.vcxproj
+3 −3 iothub_client/samples/iothub_client_sample_http_shared/windows/packages.config
+8 −8 iothub_client/samples/iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.vcxproj
+4 −4 iothub_client/samples/iothub_client_sample_mqtt/windows/packages.config
+6 −6 iothub_client/samples/iothub_client_sample_upload_to_blob/windows/iothub_client_sample_http.vcxproj
+3 −3 iothub_client/samples/iothub_client_sample_upload_to_blob/windows/packages.config
+3 −3 iothub_client/samples/iothub_client_sample_x509/iothub_client_sample_x509.c
+6 −6 iothub_client/samples/iothub_client_sample_x509/windows/iothub_client_sample_x509.vcxproj
+3 −3 iothub_client/samples/iothub_client_sample_x509/windows/packages.config
+1 −1 iothub_client/samples/readme.md
+5 −1 iothub_client/src/iothub_client.c
+872 −0 iothub_client/src/iothubtransport_amqp_cbs_auth.c
+0 −2 iothub_client/src/iothubtransport_mqtt_common.c
+4 −0 iothub_client/tests/CMakeLists.txt
+480 −0 iothub_client/tests/common_e2e/iothubclient_common_e2e.c
+1 −1 iothub_client/tests/common_e2e/iothubclient_common_e2e.cpp
+54 −54 iothub_client/tests/iothubclient_amqp_ws_e2e/CMakeLists.txt
+1 −1 iothub_client/tests/iothubclient_amqp_ws_e2e/iothubclient_amqp_ws_e2e.c
+2 −1 iothub_client/tests/iothubclient_http_e2e/iothubclient_http_e2e.cpp
+1 −1 iothub_client/tests/iothubclient_ll_u2b_ut/iothub_client_ll_u2b_ut.c
+8 −0 iothub_client/tests/iothubclient_mqtt_device_method_e2e/CMakeLists.txt
+12 −0 iothub_client/tests/iothubclient_mqtt_dt_e2e/CMakeLists.txt
+0 −2 iothub_client/tests/iothubclient_mqtt_e2e/CMakeLists.txt
+93 −0 iothub_client/tests/iothubclient_mqtt_ws_e2e/CMakeLists.txt
+39 −0 iothub_client/tests/iothubclient_mqtt_ws_e2e/iothubclient_mqtt_ws_e2e.c
+11 −0 iothub_client/tests/iothubclient_mqtt_ws_e2e/main.c
+10 −0 iothub_client/tests/iothubclient_mqtt_ws_e2e/suppressions.supp
+61 −2 iothub_client/tests/iothubclient_ut/iothubclient_ut.c
+27 −0 iothub_client/tests/iothubtransport_amqp_cbs_auth_ut/CMakeLists.txt
+1,834 −0 iothub_client/tests/iothubtransport_amqp_cbs_auth_ut/iothubtransport_amqp_cbs_auth_ut.c
+13 −0 iothub_client/tests/iothubtransport_amqp_cbs_auth_ut/main.c
+1 −1 iothub_client/tests/version_ut/version_ut.c
+74 −17 iothub_service_client/devdoc/requirement_docs/iothubserviceclient_registrymanager_requirements.md
+12 −2 iothub_service_client/inc/iothub_registrymanager.h
+1 −1 iothub_service_client/parson
+3 −0 iothub_service_client/samples/iothub_registrymanager_sample/iothub_registrymanager_sample.c
+4 −0 iothub_service_client/samples/iothub_service_client_sample/iothub_service_client_sample.c
+120 −10 iothub_service_client/src/iothub_registrymanager.c
+769 −53 iothub_service_client/tests/iothub_rm_ut/iothub_rm_ut.c
+1 −1 parson
+5 −5 serializer/samples/remote_monitoring/windows/packages.config
+10 −10 serializer/samples/remote_monitoring/windows/remote_monitoring.vcxproj
+5 −5 serializer/samples/simplesample_amqp/windows/packages.config
+10 −10 serializer/samples/simplesample_amqp/windows/simplesample_amqp.vcxproj
+4 −4 serializer/samples/simplesample_http/windows/packages.config
+8 −8 serializer/samples/simplesample_http/windows/simplesample_http.vcxproj
+5 −5 serializer/samples/simplesample_mqtt/windows/packages.config
+10 −10 serializer/samples/simplesample_mqtt/windows/simplesample_mqtt.vcxproj
+4 −4 serializer/samples/temp_sensor_anomaly/windows/packages.config
+8 −8 serializer/samples/temp_sensor_anomaly/windows/temp_sensor_anomaly.vcxproj
+1 −1 serializer/src/jsondecoder.c
+1 −0 testtools/iothub_test/src/iothub_account.c
+1 −1 uamqp
+1 −1 umqtt
12 changes: 10 additions & 2 deletions service/samples/iothub_registrymanager_sample.py
Expand Up @@ -27,6 +27,12 @@ def printDeviceInfo(title, iothubDevice):
print("iothubDevice.statusReason = {0}".format(iothubDevice.statusReason))
print("iothubDevice.statusUpdatedTime = {0}".format(iothubDevice.statusUpdatedTime))
print("iothubDevice.lastActivityTime = {0}".format(iothubDevice.lastActivityTime))
print("iothubDevice.cloudToDeviceMessageCount = {0}".format(iothubDevice.cloudToDeviceMessageCount))
print("iothubDevice.isManaged = {0}".format(iothubDevice.isManaged))
print("iothubDevice.configuration = {0}".format(iothubDevice.configuration))
print("iothubDevice.deviceProperties = {0}".format(iothubDevice.deviceProperties))
print("iothubDevice.serviceProperties = {0}".format(iothubDevice.serviceProperties))
print("iothubDevice.authMethod = {0}".format(iothubDevice.authMethod))
print("")

def iothub_registrymanager_sample_run():
Expand All @@ -38,7 +44,8 @@ def iothub_registrymanager_sample_run():
# CreateDevice
primaryKey = "aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnoo"
secondaryKey = "111222333444555666777888999000aaabbbcccdddee"
newDevice = iothubRegistryManager.create_device(device_id, primaryKey, secondaryKey)
authMethod = IoTHubRegistryManagerAuthMethod.SHARED_PRIVATE_KEY;
newDevice = iothubRegistryManager.create_device(device_id, primaryKey, secondaryKey, authMethod)
printDeviceInfo("CreateDevice", newDevice)

# GetDevice
Expand All @@ -49,7 +56,8 @@ def iothub_registrymanager_sample_run():
primaryKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
secondaryKey = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
status = IoTHubDeviceStatus.DISABLED
iothubRegistryManager.update_device(device_id, primaryKey, secondaryKey, status)
authMethod = IoTHubRegistryManagerAuthMethod.SHARED_PRIVATE_KEY;
iothubRegistryManager.update_device(device_id, primaryKey, secondaryKey, status, authMethod)
updatedDevice = iothubRegistryManager.get_device(device_id)
printDeviceInfo("UpdateDevice", updatedDevice)

Expand Down
19 changes: 17 additions & 2 deletions service/src/iothub_service_client_python.cpp
Expand Up @@ -869,7 +869,8 @@ class IoTHubRegistryManager
IOTHUB_DEVICE CreateDevice(
std::string deviceId,
std::string primaryKey,
std::string secondaryKey
std::string secondaryKey,
IOTHUB_REGISTRYMANAGER_AUTH_METHOD authMethod
)
{
IOTHUB_DEVICE iothubDevice;
Expand All @@ -879,6 +880,7 @@ class IoTHubRegistryManager
deviceCreate.deviceId = deviceId.c_str();
deviceCreate.primaryKey = primaryKey.c_str();
deviceCreate.secondaryKey = secondaryKey.c_str();
deviceCreate.authMethod = authMethod;

ScopedGILRelease release;
result = IoTHubRegistryManager_CreateDevice(_iothubRegistryManagerHandle, &deviceCreate, &iothubDevice);
Expand Down Expand Up @@ -911,7 +913,8 @@ class IoTHubRegistryManager
std::string deviceId,
std::string primaryKey,
std::string secondaryKey,
IOTHUB_DEVICE_STATUS status
IOTHUB_DEVICE_STATUS status,
IOTHUB_REGISTRYMANAGER_AUTH_METHOD authMethod
)
{
IOTHUB_REGISTRYMANAGER_RESULT result = IOTHUB_REGISTRYMANAGER_OK;
Expand All @@ -921,6 +924,7 @@ class IoTHubRegistryManager
deviceUpdate.primaryKey = primaryKey.c_str();
deviceUpdate.secondaryKey = secondaryKey.c_str();
deviceUpdate.status = status;
deviceUpdate.authMethod = authMethod;

ScopedGILRelease release;
result = IoTHubRegistryManager_UpdateDevice(_iothubRegistryManagerHandle, &deviceUpdate);
Expand Down Expand Up @@ -1772,6 +1776,11 @@ BOOST_PYTHON_MODULE(IMPORT_NAME)
.value("CALLBACK_NOT_SET", IOTHUB_REGISTRYMANAGER_CALLBACK_NOT_SET)
;

enum_<IOTHUB_REGISTRYMANAGER_AUTH_METHOD>("IoTHubRegistryManagerAuthMethod")
.value("SHARED_PRIVATE_KEY", IOTHUB_REGISTRYMANAGER_AUTH_SPK)
.value("X509_THUMBPRINT", IOTHUB_REGISTRYMANAGER_AUTH_X509_THUMBPRINT)
;

enum_<IOTHUB_MESSAGING_RESULT>("IoTHubMessagingResult")
.value("OK", IOTHUB_MESSAGING_OK)
.value("INVALID_ARG", IOTHUB_MESSAGING_INVALID_ARG)
Expand Down Expand Up @@ -1849,6 +1858,12 @@ BOOST_PYTHON_MODULE(IMPORT_NAME)
.add_property("statusReason", &IOTHUB_DEVICE::statusReason)
.add_property("statusUpdatedTime", &IOTHUB_DEVICE::statusUpdatedTime)
.add_property("lastActivityTime", &IOTHUB_DEVICE::lastActivityTime)
.add_property("cloudToDeviceMessageCount", &IOTHUB_DEVICE::cloudToDeviceMessageCount)
.add_property("isManaged", &IOTHUB_DEVICE::isManaged)
.add_property("configuration", &IOTHUB_DEVICE::configuration)
.add_property("deviceProperties", &IOTHUB_DEVICE::deviceProperties)
.add_property("serviceProperties", &IOTHUB_DEVICE::serviceProperties)
.add_property("authMethod", &IOTHUB_DEVICE::authMethod)
;

class_<IOTHUB_REGISTRY_STATISTICS>("IoTHubRegistryStatistics", no_init)
Expand Down
10 changes: 8 additions & 2 deletions service/tests/iothub_service_client_ut.py
Expand Up @@ -621,6 +621,7 @@ def test_IoTHubRegistryManager(self):
deviceId = "deviceId"
primaryKey = "primaryKey"
secondaryKey = "secondaryKey"
authMethod = IoTHubRegistryManagerAuthMethod.SHARED_PRIVATE_KEY;
with self.assertRaises(AttributeError):
regManClient.CreateDevice()
with self.assertRaises(Exception):
Expand All @@ -629,7 +630,9 @@ def test_IoTHubRegistryManager(self):
regManClient.create_device(deviceId)
with self.assertRaises(Exception):
regManClient.create_device(deviceId, primaryKey)
result = regManClient.create_device(deviceId, primaryKey, secondaryKey)
with self.assertRaises(Exception):
regManClient.create_device(deviceId, primaryKey, secondaryKey)
result = regManClient.create_device(deviceId, primaryKey, secondaryKey, authMethod)
self.assertIsInstance(result, IoTHubDevice)

# get_device
Expand All @@ -646,6 +649,7 @@ def test_IoTHubRegistryManager(self):
primaryKey = "primaryKey"
secondaryKey = "secondaryKey"
status = IoTHubDeviceStatus.ENABLED
authMethod = IoTHubRegistryManagerAuthMethod.SHARED_PRIVATE_KEY;
with self.assertRaises(AttributeError):
regManClient.UpdateDevice()
with self.assertRaises(Exception):
Expand All @@ -656,7 +660,9 @@ def test_IoTHubRegistryManager(self):
regManClient.update_device(deviceId, primaryKey)
with self.assertRaises(Exception):
regManClient.update_device(deviceId, primaryKey, secondaryKey)
regManClient.update_device(deviceId, primaryKey, secondaryKey, status)
with self.assertRaises(Exception):
regManClient.create_device(deviceId, primaryKey, secondaryKey, status)
regManClient.update_device(deviceId, primaryKey, secondaryKey, status, authMethod)

# delete_device
deviceId = "deviceId"
Expand Down

0 comments on commit 6728716

Please sign in to comment.