Commit 12914923ebe894906dc1c4d3104a1f8a23b0f5b6
Committed by
Andrew Shvayka
1 parent
a84160a1
azure iot hub rule node improvements
Showing
2 changed files
with
1 additions
and
3 deletions
... | ... | @@ -48,7 +48,6 @@ public class TbAzureIotHubNode extends TbMqttNode { |
48 | 48 | public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException { |
49 | 49 | try { |
50 | 50 | this.mqttNodeConfiguration = TbNodeUtils.convert(configuration, TbMqttNodeConfiguration.class); |
51 | - | |
52 | 51 | mqttNodeConfiguration.setPort(8883); |
53 | 52 | mqttNodeConfiguration.setCleanSession(true); |
54 | 53 | MqttClientCredentials credentials = mqttNodeConfiguration.getCredentials(); |
... | ... | @@ -76,7 +75,6 @@ public class TbAzureIotHubNode extends TbMqttNode { |
76 | 75 | if (credentials instanceof AzureIotHubSasCredentials) { |
77 | 76 | AzureIotHubSasCredentials sasCredentials = (AzureIotHubSasCredentials) credentials; |
78 | 77 | config.setPassword(AzureIotHubUtil.buildSasToken(mqttNodeConfiguration.getHost(), sasCredentials.getSasKey())); |
79 | -// config.setPassword("SharedAccessSignature sr=TBIoT2.azure-devices.net%2Fdevices%2Fdevice&sig=gTu9ZBFydojRXpCWC0fq3C6vfC%2FBevULhdsy4CzWa0Y%3D&se=1594986116"); | |
80 | 78 | } |
81 | 79 | } |
82 | 80 | }); | ... | ... |
... | ... | @@ -163,7 +163,7 @@ public class CertPemClientCredentials implements MqttClientCredentials { |
163 | 163 | |
164 | 164 | private KeySpec getKeySpec(byte[] encodedKey) throws Exception { |
165 | 165 | KeySpec keySpec; |
166 | - if (password == null) { | |
166 | + if (password == null || password.isEmpty()) { | |
167 | 167 | keySpec = new PKCS8EncodedKeySpec(encodedKey); |
168 | 168 | } else { |
169 | 169 | PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray()); | ... | ... |