|
|
@ -19,6 +19,9 @@ import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.eclipse.californium.elements.util.SslContextUtil; |
|
|
import org.eclipse.californium.elements.util.SslContextUtil; |
|
|
import org.eclipse.californium.scandium.config.DtlsConnectorConfig; |
|
|
import org.eclipse.californium.scandium.config.DtlsConnectorConfig; |
|
|
|
|
|
import org.eclipse.leshan.core.model.ObjectLoader; |
|
|
|
|
|
import org.eclipse.leshan.core.model.ObjectModel; |
|
|
|
|
|
import org.eclipse.leshan.core.model.StaticModel; |
|
|
import org.eclipse.leshan.server.bootstrap.BootstrapSessionManager; |
|
|
import org.eclipse.leshan.server.bootstrap.BootstrapSessionManager; |
|
|
import org.eclipse.leshan.server.californium.bootstrap.LeshanBootstrapServer; |
|
|
import org.eclipse.leshan.server.californium.bootstrap.LeshanBootstrapServer; |
|
|
import org.eclipse.leshan.server.californium.bootstrap.LeshanBootstrapServerBuilder; |
|
|
import org.eclipse.leshan.server.californium.bootstrap.LeshanBootstrapServerBuilder; |
|
|
@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.thingsboard.server.transport.lwm2m.bootstrap.secure.LwM2MBootstrapSecurityStore; |
|
|
import org.thingsboard.server.transport.lwm2m.bootstrap.secure.LwM2MBootstrapSecurityStore; |
|
|
import org.thingsboard.server.transport.lwm2m.bootstrap.secure.LwM2MInMemoryBootstrapConfigStore; |
|
|
import org.thingsboard.server.transport.lwm2m.bootstrap.secure.LwM2MInMemoryBootstrapConfigStore; |
|
|
|
|
|
import org.thingsboard.server.transport.lwm2m.bootstrap.secure.LwM2MInMemoryBootstrapConfigurationAdapter; |
|
|
import org.thingsboard.server.transport.lwm2m.bootstrap.secure.LwM2mDefaultBootstrapSessionManager; |
|
|
import org.thingsboard.server.transport.lwm2m.bootstrap.secure.LwM2mDefaultBootstrapSessionManager; |
|
|
import org.thingsboard.server.transport.lwm2m.config.LwM2MTransportBootstrapConfig; |
|
|
import org.thingsboard.server.transport.lwm2m.config.LwM2MTransportBootstrapConfig; |
|
|
import org.thingsboard.server.transport.lwm2m.config.LwM2MTransportServerConfig; |
|
|
import org.thingsboard.server.transport.lwm2m.config.LwM2MTransportServerConfig; |
|
|
@ -38,6 +42,7 @@ import java.security.KeyStoreException; |
|
|
import java.security.PrivateKey; |
|
|
import java.security.PrivateKey; |
|
|
import java.security.PublicKey; |
|
|
import java.security.PublicKey; |
|
|
import java.security.cert.X509Certificate; |
|
|
import java.security.cert.X509Certificate; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
import static org.thingsboard.server.transport.lwm2m.server.LwM2mNetworkConfig.getCoapConfig; |
|
|
import static org.thingsboard.server.transport.lwm2m.server.LwM2mNetworkConfig.getCoapConfig; |
|
|
|
|
|
|
|
|
@ -79,12 +84,14 @@ public class LwM2MTransportBootstrapService { |
|
|
builder.setCoapConfig(getCoapConfig(bootstrapConfig.getPort(), bootstrapConfig.getSecurePort(), serverConfig)); |
|
|
builder.setCoapConfig(getCoapConfig(bootstrapConfig.getPort(), bootstrapConfig.getSecurePort(), serverConfig)); |
|
|
|
|
|
|
|
|
/* Define model provider (Create Models )*/ |
|
|
/* Define model provider (Create Models )*/ |
|
|
|
|
|
List<ObjectModel> models = ObjectLoader.loadDefault(); |
|
|
|
|
|
builder.setModel(new StaticModel(models)); |
|
|
|
|
|
|
|
|
/* Create credentials */ |
|
|
/* Create credentials */ |
|
|
this.setServerWithCredentials(builder); |
|
|
this.setServerWithCredentials(builder); |
|
|
|
|
|
|
|
|
// /** Set securityStore with new ConfigStore */
|
|
|
/* Set securityStore with new ConfigStore */ |
|
|
// builder.setConfigStore(lwM2MInMemoryBootstrapConfigStore);
|
|
|
builder.setConfigStore(new LwM2MInMemoryBootstrapConfigurationAdapter(lwM2MInMemoryBootstrapConfigStore)); |
|
|
|
|
|
|
|
|
/* SecurityStore */ |
|
|
/* SecurityStore */ |
|
|
builder.setSecurityStore(lwM2MBootstrapSecurityStore); |
|
|
builder.setSecurityStore(lwM2MBootstrapSecurityStore); |
|
|
|