优化协议
This commit is contained in:
parent
bce0889563
commit
ecf4e534b3
Binary file not shown.
2
pom.xml
2
pom.xml
|
@ -69,7 +69,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jetlinks</groupId>
|
||||
<artifactId>jetlinks-supports</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.1.4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -48,7 +48,7 @@ public class JetLinksAuthenticator implements Authenticator {
|
|||
//签名
|
||||
String digest = DigestUtils.md5Hex(username + "|" + secureKey);
|
||||
if (requestSecureId.equals(secureId) && digest.equals(password)) {
|
||||
return AuthenticationResponse.success();
|
||||
return AuthenticationResponse.success(deviceOperation.getDeviceId());
|
||||
} else {
|
||||
return AuthenticationResponse.error(401, "密钥错误");
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jetlinks.protocol.official;
|
|||
import org.jetlinks.core.defaults.CompositeProtocolSupport;
|
||||
import org.jetlinks.core.message.codec.DefaultTransport;
|
||||
import org.jetlinks.core.metadata.DefaultConfigMetadata;
|
||||
import org.jetlinks.core.metadata.DeviceConfigScope;
|
||||
import org.jetlinks.core.metadata.types.EnumType;
|
||||
import org.jetlinks.core.metadata.types.PasswordType;
|
||||
import org.jetlinks.core.metadata.types.StringType;
|
||||
|
@ -27,8 +28,8 @@ public class JetLinksProtocolSupportProvider implements ProtocolSupportProvider
|
|||
"CoAP认证配置",
|
||||
"使用CoAP进行数据上报时,需要对数据进行加密:" +
|
||||
"encrypt(payload,secureKey);")
|
||||
.add("encAlg", "加密算法", "加密算法",
|
||||
new EnumType().addElement(EnumType.Element.of("AES", "AES加密(ECB,PKCS#5)", "加密模式:ECB,填充方式:PKCS#5")))
|
||||
.add("encAlg", "加密算法", "加密算法", new EnumType()
|
||||
.addElement(EnumType.Element.of("AES", "AES加密(ECB,PKCS#5)", "加密模式:ECB,填充方式:PKCS#5")), DeviceConfigScope.product)
|
||||
.add("secureKey", "密钥", "16位密钥KEY", new PasswordType());
|
||||
|
||||
private static final DefaultConfigMetadata coapDTLSConfig = new DefaultConfigMetadata(
|
||||
|
|
Loading…
Reference in New Issue